接入终端
## 接入用户(接入终端)
接入的用户查看,接入用户管理。
### 一、 信息展示
导入头文件`#import <H3CMagicKit/H3CGatewayObject+AccessUser.h`
#### 1.1 获取接入用户列表
接入用户列表
```
[H3CGatewayObject getGatewayAccessUserListWithSuccess:^(NSMutableArray * _Nonnull userList, NSMutableArray * _Nonnull onlineList, NSMutableArray * _Nonnull offlineList) {
} failure:^(H3CError *error) {
}];
```
数组内对象为`H3CAccessUserModel`,字段详解见API描述。
>w 1、中继模式下仅显示Wi-Fi接入的用户;
2、中继模式下不支持接入用户速率、以及路由器的速率显示;
#### 1.2 获取路由器、接入用户速率
获取接入用户的速率。
```
[H3CGatewayObject getGatewayRateWithSuccess:^(H3CRouterRateModel * _Nonnull rateModel) {
} failure:^(H3CError *error) {
}];
```
若要显示接入用户速率,可以通过终端列表接口拿到终端mac地址,根据mac地址从速率列表匹配速率。
>w 1、中继模式下不支持接入用户速率、以及路由器的速率显示。
#### 1.3 获取网关是否为中继模式
获取网关是否为中继模式,网关为中继模式很多功能无法使用,该接口使用频次较高。
```
[H3CGatewayObject getNetworkSettingTrunKSatateInfoWithSuccess:^(BOOL isRepeating) {
} failure:^(H3CError *error) {
}];
```
#### 1.4 获取接入用户详细展示
* 速率展示需21位能力集支持、用户在线、能获取到终端ip
* 用户限速需20位能力集或者33位支持、能获取到终端ip
* 用户禁止上网需19位能力集支持
* 用户禁止接入(接入黑名单)需18位能力集支持
* 用户禁止接入(接入黑名单)需18位能力集支持
* 用户定时设置需17位能力集支持
#### 1.5 获取单个终端的的速率
根据终端mac、ip获取单个终端的的速率。
```
[H3CGatewayObject getAccessRateWithUserMac:_userInfo.userMac success:^(H3CUserRateModel *
_Nonnull rateModel) {
} failure:^(H3CError *error) {
}];
```
### 二、 终端管理
导入头文件`#import <H3CMagicKit/H3CGatewayObject+AccessUser.h`
>w 1、中继模式不支持速率展示、限速、允许上网控制、定时上网控制
#### 2.1 修改终端名称、禁止终端上网、禁止终端接入
通过修改userName、attrs.originInternetAllow、attrs.wirelessAllowCtrl字段修改改终端名称、禁止终端上网、禁止终端接入。
```
H3CWirelessAllowAttrs *attrs = [[H3CWirelessAllowAttrs alloc] init];
attrs.userMac = _userInfo.userMac;
attrs.userIp = _userInfo.userIp;
attrs.userName = _userInfo.userName;
attrs.originInternetAllow = wSelf.userInfo.originInternetAllow;
attrs.wirelessAllowCtrl = @"forbid";
[H3CGatewayObject setGatewayAccessUserWirelessAllowWithWirelessAllowAttrs:attrs success:^(id obj) {
} failure:^(H3CError *error) {
}];
```
#### 2.2 终端限速设置
```
H3CRateLimitAttrs *attrs = [[H3CRateLimitAttrs alloc] init];
attrs.userMac = wSelf.userInfo.userMac;
attrs.userIp = wSelf.userInfo.userIp;
attrs.rxRateLimit = [wSelf.rxLimit floatValue];
attrs.txRateLimit = [wSelf.txLimit floatValue];
attrs.bandStatus = wSelf.userInfo.bandStatus;
[H3CGatewayObject setGatewayAccessUserRateLimitWithRateLimitAttrs:attrs success:^(id obj) {
} failure:^(H3CError *error) {
}];
```
设置限速参数下发,其他参数从终端列表接口获取传到单个终端页面。
#### 2.3 终端定时上网
* 获取终端定时上网列表
```
[H3CGatewayObject getGatewayAccessUserTimingNetInfoWithUserMac:self.userMac success:^(H3CAccessUserModel * _Nonnull accessUserModel) {
} failure:^(H3CError *error) {
}];
```
`accessUserModel`的`timerPower`字段`on`代表定时开关打开;
`timeRanges`数组代表时段。
* 设置终端定时上网列表
```
[H3CGatewayObject setGatewayAccessUserTimingNetWithUserMac:self.userMac timerPower:timerPower timeRanges:timeRangesOpened success:^(id obj) {
} failure:^(H3CError *error) {
}];
```
>w 接口需要能力集17位支持
#### 2.4 清除终端列表
移除终端列表。
```
[H3CGatewayObject clearAccessUserWithUserMacs:tempArr success:^(id obj) {
} failure:^(H3CError *error) {
}];
```
根据终端的mac地址数组清除指定的终端。
>w 接口需要能力集45位支持
### 三、 能力集
| 能力集序号|能力集属性|描述|
|-|-|-|
|45| isSupportOfflineUserClear | 是否支持离线用户删除、特定终端删除|
|17| isSupportInternetTiming | 是否支持接入用户定时上网|
|18| isSupportWiFiRoot | 是否支持接入用户无线接入权限控制|
|19| isSupportInternetRoot | 接入用户上网权限控制|
|20| isSupportLimitSpeed | 是否支持接入用户限速|
|21| isSupportSpeedStatistics | 是否支持故接入用户流量统计|
|33| isSupportOnlyDownLimitSpeed | 是否仅支持下行限速|