当前位置: 首页 > 文档资料 > Rokid IOS SDK 文档 >

获取单个设备

优质
小牛编辑
121浏览
2023-12-01

通过 id 获取 device 信息

参数说明

字段类型必须?说明
deviceIdString设备Id

接口定义

Swift:

let device = RokidMobileSDK.device.getDevice(deviceId: String) -> RKDevice?

Objc:

RKDevice * device = [RokidMobileSDK.device getDeviceWithDeviceId:self.device.id];

ping 主动获得 device 在线状态

参数说明

字段类型必须?说明
deviceRKDevice

接口定义

Swift:

pingDevice(device: device) { (error, device) in
}

Objc:

 RKDevice * device = [RokidMobileSDK.device getCurrentDevice];
            [RokidMobileSDK.device pingDeviceWithDevice:device completion:^(RKError * error, RKDevice * device) {
                NSLog(@"%@, %@",error.message, device);
                NSLog(@"info %s ", device.alive ? "alive" : "not alive");
            }];