Skip to content

Device Management

Feature Description

Device management provides operations related to device lists, device information, and device configuration.

objc
#import <QuecDeviceKit/QuecDeviceKit.h>
///Initialization.
[QuecDeviceService sharedInstance]

In the device management class, you will frequently use the QuecDeviceModel class. The properties are defined as follows:

QuecDeviceModel Definition

FieldTypeDescription
accessTypeString0-Directly connected device
1-Gateway
2-Sub-device
activeTimeStringActivation time.
activeTimeTslongActivation timestamp.
authKeyStringAuthorizationKey.
deviceBindTimeStringDevice binding time.
deviceBindTimeTslongDevice binding timestamp.
deviceCreateTimeStringDevice creation time.
deviceKeyStringDeviceKey.
deviceNameStringDevice name.
deviceStatusStringDevice online status.
Offline
Online
onlineStatusintDevice online status.
0-Offline
1-Online
deviceTypeintDevice type.
1 Owned device
2 Shared device
invaildTimeStringExpiration time.
invaildTimeTslongExpiration timestamp.
lastConnTimeStringLast connection time.
lastConnTimeTsStringLast connection timestamp.
locateTypeStringSupported positioning types.
ownerUidStringUser ID of the sharer.
phoneStringBound phone number.
productKeyStringProductKey.
productNameStringProduct name.
protocolStringConnection protocol.
uidStringBound user ID.
userNameStringBound user nickname.
verifiedStringWhether device binding is authenticated.
0 - Unauthenticated
1 - Authenticated
signalStrengthStringSignal strength.
statusintBinding status.
1 - Normal
2 - Invalid
lastOfflineTimeStringOffline time.
lastOfflineTimeTslongOffline timestamp.
btPwdStringBluetooth password.
bindTypeStringBinding type.
1 - SN binding
2 - Wi-Fi binding
3 - PKDK binding
4 - Bluetooth binding
authCodeStringAuthorization code.
logoImageStringProduct logo.
snStringSerial number.
productIconStringProduct image.
upgradeStatusintOTA status.
0 - Not upgraded
1 - Upgrading
2 - Successful upgrade
3 - Upgrade failed
userConfirmStatusintUser confirmation status for an OTA upgrade.
planIdlongPlan ID.
capabilitiesBitmaskintDevice channel capability mask.
bindModeintBinding mode.
1 - Multi-binding
2 - Single binding
3 - Alternate binding
deviceIdStringUnique device identifier, determined by ProductKey and DeviceKey.
onlineChannelStateintChannel online/offline status, including near-field and Websocket connection.
connectingChannelStateintChannel connecting status.
isMatterintWhether it is a Matter device.
0 - No
1 - Yes
networkTypeStringNetwork type.
1 - Wi-Fi
2 - Cellular
3 - NB-IoT
5 - Bluetooth
matterInfoQuecDeviceMatterMetaMatter metadata.
firstItemCodeStringPrimary category code.
firstItemNameStringPrimary category name.
secondItemCodeStringSecondary category code.
secondItemNameStringSecondary category name.
lowPowerProductbooleanWhether it is a low-power product.
lowPowerStatusbooleanWhether the low-power mode is enabled.
lowPowerCacheintCache duration in low-power mode. Unit: second.
isCommonUsedbooleanWhether the device is commonly used.
fidStringHome ID.
fridStringRoom ID.
roomNameStringRoom name.
shareCodeStringShare code.
isSharedbooleanWhether it is a shared device.
gdidStringGroup ID.
isGroupDevicebooleanWhether it is a group device.
groupDeviceDeviceNumintNumber of devices in the group.
dpsNSDictionaryDPS data.
bindingCodeStringBinding code.
btLastUseTimelongLast Bluetooth usage time (millisecond timestamp).
lowPowerAliveintHeartbeat interval in low-power mode. Unit: minute.
aiCapabilityStatusbooleanWhether it supports AI capabilities.

Device Management

Get Device List

API

Get a list of devices. You need to call the binding interface to associate the device and user relationship first.

objc
- (void)getDeviceListWithParams:(QuecDeviceListParamsModel *)params 
                         success:(void(^)(NSArray<QuecDeviceModel *> *list, NSInteger total))success
                         failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
paramsYQuecDeviceListParamsModel类
successNCallback function of successful request.
failureNCallback function of failed request.

QuecDeviceListParamsModel Definition

FieldTypeDescription
pageNumberNSIntegerPage number. (Required)
pageSizeNSIntegerPage size. (Required)
isAssociationBOOLDevice association management parameter. (Optional)
secondItemCodeNSStringSecondary category parameter. (Optional)
pkListNSStringProductKey list, separated by commas. (Optional)
deviceNameNSStringDevice name - used for searching devices. (Optional)

See QuecDeviceModel Definition above.

Example

objc
QuecDeviceListParamsModel *paramsModel = QuecDeviceListParamsModel.new;
paramsModel.deviceName = @"searchKey";
paramsModel.pageNumber = 1;
paramsModel.pageSize = pageSize;
[QuecDeviceService.sharedInstance getDeviceListWithParams:paramsModel success:^(NSArray<QuecDeviceModel *> *list, NSInteger total) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Query Whether Device Can Be Bound

API

Query whether the user can bind the device.

objc
- (void)getDeviceInfoBindingWithProductKey:(NSString *)productKey
                                   deviceKey:(NSString *)deviceKey
                           checkExistInCloud:(BOOL)checkExistInCloud
                                     success:(void(^)(QuecDeviceBindInfoModel *bindInfoModel))success
                                     failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyNDeviceKey.
checkExistInCloudNVerify whether the device exists in the platform.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecDeviceBindInfoModel Definition

FieldTypeDescription
activeBluetoothBOOLWhether prioritizing activating the device via Bluetooth is enabled.
true - Enabled
false - Disbled
productNameNSStringProduct name.
productLogoNSStringProduct image.
bindingModeintBinding mode.
1 - Multi-binding
2 - Single binding
3 - Alternate binding

Example

objc
[QuecDeviceService.sharedInstance getDeviceInfoBindingWithProductKey:@"pk"
                                                            deviceKey:@""
                                                    checkExistInCloud:NO
                                                        success:^(QuecDeviceBindInfoModel  *bindInfoModel) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Bind Device via SN

API

Bind a device via the serial number.

objc
- (void)bindDeviceWithSerialNumber:(NSString *)serialNumber
                        productKey:(NSString *)productKey
                        deviceName:(NSString *)deviceName
                           success:(void(^)(QuecDeviceBindSNModel *model))success
                           failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
serialNumberYDevice SN.
productKeyYProductKey.
deviceNameNDevice name.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecDeviceBindSNModel Definition

FieldTypeDescription
authKeyNSStringAuthenticationKey.
dkNSStringDeviceKey.
pkNSStringProductKey.
moduleTypeNSStringDevice model.

Example

objc
[QuecDeviceService.sharedInstance bindDeviceWithSerialNumber:@"sn" productKey:@"pk" deviceName:@"name" success:^(QuecDeviceBindSNModel *model) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Bind Device via authCode

API

Bind a device via the Authentication Code (applicable to Wi-Fi/Wi-Fi + Bluetooth devices).

objc
- (void)bindWifiDeviceWithAuthCode:(NSString *)authCode
                        productKey:(NSString *)productKey
                         deviceKey:(NSString *)deviceKey
                        deviceName:(NSString *)deviceName
               capabilitiesBitmask:(NSInteger)capabilitiesBitmask
                           success:(void(^)(QuecDeviceBindAuthCodeModel *model))success
                           failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
authCodeYDevice Authentication Code.
productKeyYProductKey.
deviceKeyYDeviceKey.
deviceNameNDevice name.
capabilitiesBitmaskNDevice network connection capability. Refer to QuecIotChannelBitMask.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecDeviceBindAuthCodeModel Definition

FieldTypeDescription
authKeyNSStringAuthenticationKey.
productLogoNSStringProduct image.
productNameNSStringProduct name.
bindingModeNSStringBinding mode.
1 - Multi-binding
2 - Single binding
3 - Alternate binding

Example

objc
[QuecDeviceService.sharedInstance bindWifiDeviceWithAuthCode:@"authCode"
                                                        productKey:@"productKey"
                                                        deviceKey:@"deviceKey"
                                                        deviceName:@"deviceName"
                                                capabilitiesBitmask:0
                                                            success:^(QuecDeviceBindAuthCodeModel *model) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Bind Bluetooth-only Device

API

Bind a device via the Authentication Code + password (applicable to Bluetooth-only devices).

objc
- (void)bindPureBtDeviceWithEncryptedBindingCode:(NSString *)encryptedBindingCode
                                      productKey:(NSString *)productKey
                                       deviceKey:(NSString *)deviceKey
                                        password:(NSString *)password
                                          random:(NSString *)random
                                      deviceName:(NSString *)deviceName
                                  isCommonDevice:(BOOL)isCommonDevice
                             capabilitiesBitmask:(NSInteger)capabilitiesBitmask
                       encryptedNewBindingSecret:(NSString *)encryptedNewBindingSecret
                       encryptedOldBindingSecret:(NSString *)encryptedOldBindingSecret
                                         success:(QuecVoidBlock)success
                                         failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
encryptedBindingCodeYEncrypted binding code.
productKeyYProductKey.
deviceKeyYDeviceKey.
passwordNDevice password.
randomYRandom value returned by the device.
deviceNameNDevice name.
isCommonDeviceYWhether to add the device into the common list.
capabilitiesBitmaskNDevice network connection capability. Refer to QuecIotChannelBitMask.
encryptedNewBindingSecretYNew encrypted bindingSecret.
encryptedOldBindingSecretNOld encrypted bindingSecret.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[[QuecDeviceService sharedInstance] bindPureBtDeviceWithEncryptedBindingCode:@"encryptedBindingCode"
                                                     productKey:@"pk"
                                                      deviceKey:@"dk"
                                                       password:@""
                                                         random:@"random"
                                                     deviceName:@"deviceName"
                                                 isCommonDevice:YES
                                            capabilitiesBitmask:4
                                      encryptedNewBindingSecret:@"encryptedNewBindingsecret" 
                                      encryptedOldBindingSecret:@"encryptedOldBindingsecret" 
                                                         success:^{
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Edit Device Name

API

Edit a device name.

objc
- (void)updateDeviceName:(NSString *)deviceName 
               productKey:(NSString *)productKey
                deviceKey:(NSString *)deviceKey
                  success:(QuecVoidBlock)success
                  failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
deviceNameYDevice name.
productKeyYProductKey.
deviceKeyYDeviceKey.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[[QuecDeviceService sharedInstance] updateDeviceName:@"deviceName" productKey:@"productKey" deviceKey:@"deviceKey" success:^{
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Get Device Details

API

Get device details.

objc
- (void)getDeviceInfoByDeviceKey:(NSString *)deviceKey 
                       productKey:(NSString *)productKey
                          success:(void(^)(QuecDeviceModel *model))success
                          failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
successNCallback function of successful request.
failureNCallback function of failed request.

See QuecDeviceModel Definition above.

Example

objc
[[QuecDeviceService sharedInstance] getDeviceInfoByDeviceKey:dk productKey:pk success:^(QuecDeviceModel *model) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);           
    }];

Get Device TSL and Business Property

API

Get the device TSL model and business properties.

objc
- (void)getProductTslAndDeviceBusinessAttributesWithProductKey:(NSString *)productKey
                                                        deviceKey:(NSString *)deviceKey
                                                        gatewayPk:(NSString *)gatewayPk
                                                        gatewayDk:(NSString *)gatewayDk
                                                         codeList:(NSString *)codeList
                                                             type:(NSString *)type
                                                       success:(void (^)(NSArray<QuecProductTSLPropertyModel *> *list))success
                                                          failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
gatewayPkNProductKey of the gateway.
gatewayDkNDeviceKey of the gateway.
codeListNProperty ID list, used with type. Separate multiple properties by commas.
typeNQuery type, supporting single selection and multiple selection. Separate multiple types by commas.
1 Query basic device property
2 Query TSL property
3 Query location information
successNCallback function of successful request.
failureNCallback function of failed request.

QuecProductTSLPropertyModel Definition

FieldTypeDescription
specsNSArray<QuecProductTSLSpecModel *> *TSL data.
formatSpecsNSArray<QuecProductTSLSpecModel *> *TSL data, the same as specs.
dataTypeNSStringData type.
attributeValueNSStringProperty value.
codeNSStringCode.
nameNSStringName.
subTypeNSStringRead/Write type.
itemIdNSIntegerID.
sortNSStringOrder.
typeNSStringType.
descNSStringDescription.

QuecProductTSLSpecModel Definition

FieldTypeDescription
specsNSArray<QuecProductTSLSpecModel *> *Nested TSL data.
formatSpecsNSArray<QuecProductTSLSpecModel *> *Nested TSL data, the same as specs.
dataTypeNSStringData type.
codeNSStringCode.
nameNSStringName.
valueNSStringValue.
itemIdNSIntegerID.
unitNSStringUnit.
minNSStringMinimum.
maxNSStringMaximum.
stepNSStringStep.
lengthNSStringText length.
sizeNSStringArray size.
attributeValueidProperty value.

Example

objc
[QuecDeviceService.sharedInstance getProductTslAndDeviceBusinessAttributesWithProductKey:@"pk"
                                                                                   deviceKey:@"dk"
                                                                                   gatewayPk:@"gatewayPk"
                                                                                   gatewayDk:@"gatewayDk"
                                                                                    codeList:@"codeList"
                                                                                        type:@"type"
                                                                                     success:^(NSArray<QuecProductTSLPropertyModel *> *list) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Get Device TSL Model

API

Get the device TSL model.

objc
- (void)getProductTSLWithProductKey:(NSString *)productKey
                            success:(void (^)(QuecProductTSLModel *tslModel))success
                            failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
productKeyYProductKey.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecProductTSLModel Definition

FieldTypeDescription
profileQuecProductTSLProfileModelProfile information
propertiesNSArray<QuecProductTSLPropertyModel *> *Property. Item: QuecProductTSLPropertyModel.
servicesNSArray<QuecProductTSLServiceModel *> *Service. Item: QuecProductTSLServiceModel.
eventsNSArray<QuecProductTSLEventModel *> *Event. Item: QuecProductTSLEventModel.

QuecProductTSLProfileModel Definition

FieldTypeDescription
productKeyNSStringProductKey.
versionNSStringVersion.
tslVersionNSStringTSL model version.

See QuecProductTSLPropertyModel Definition above.

QuecProductTSLServiceModel Definition

FieldTypeDescription
inputDataNSDictionaryService input parameter, used to describe service input data.
outputDataNSDictionaryService output parameter, used to describe service output data.

QuecProductTSLEventModel Definition

FieldTypeDescription
outputDataNSDictionaryEvent output parameter, used to describe the specific output item.

Example

objc
[[QuecDeviceService sharedInstance] getProductTSLWithProductKey:@"productKey" success:^(QuecProductTSLModel *tslModel) {
        /// Next Action
    } failure:^(NSError *error) {
         NSLog(@"check error: %@", error);
    }];

Get Device Business Property

API

Get device business properties.

objc
- (void)getDeviceBusinessAttributesWithProductKey:(NSString *)productKey 
                                          deviceKey:(NSString *)deviceKey
                                          gatewayPk:(NSString *)gatewayPk
                                          gatewayDk:(NSString *)gatewayDk
                                           codeList:(NSString *)codeList
                                               type:(NSString *)type
                                            success:(void (^)(QuecProductTSLInfoModel *tslInfoModel))success
                                            failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
gatewayPkNProductKey of the gateway.
gatewayDkNDeviceKey of the gateway.
codeListNProperty ID list, used with type. Separate multiple properties by commas.
typeNQuery type, supporting single selection and multiple selection. Separate multiple types by commas.
1 Query basic device property
2 Query TSL property
3 Query location information
successNCallback function of successful request.
failureNCallback function of failed request.

QuecProductTSLInfoModel Definition

FieldTypeDescription
customizeTslInfoNSArray<QuecProductTSLCustomInfoModel *> *Custom TSL model data reporting list.
deviceLocateInfoQuecProductTSLLocateInfoModelLocation information.
deviceDataQuecProductTSLDataModelDevice resource data.
tslResourcesInfoNSArray<QuecProductTSLResourceInfoModel *> *Resource TSL model data.

QuecProductTSLCustomInfoModel Definition

FieldTypeDescription
abIdNSIntegerFeature ID.
dataTypeNSStringData type.
nameNSStringFeature name.
resourceCodeNSStringFeature code.
resourceValueNSStringFeature value.
subTypeNSStringData operation type.
typeNSStringFeature type.

QuecProductTSLLocateInfoModel Definition

FieldTypeDescription
createTimedoubleCreation time.
deviceKeyNSStringDeviceKey.
hdopNSStringHorizontal Dilution of Precision (GPS accuracy indicator).
latNSStringLatitude.
lngNSStringLongitude.
productKeyNSStringProductKey.
latTypeNSStringLatitude hemisphere (N/S).
lngTypeNSStringLongitude hemisphere (W/E).
locateRawNSStringRaw positioning data.
locateStatusNSStringDifferential/non-differential positioning status.
locateTimeNSStringPositioning time.
locateTypeNSStringPositioning method type.
satellitesNSStringNumber of connected satellites.
bdLatNSStringLatitude in BD09 coordinate system.
bdLngNSStringLongitude in BD09 coordinate system.
gcjLatNSStringLatitude in GCJ coordinate system.
gcjLngNSStringLongitude in GCJ coordinate system.
wgsLatNSStringRaw GPS latitude (WGS84).
wgsLngNSStringRaw GPS longitude (WGS84).

QuecProductTSLDataModel Definition

FieldTypeDescription
batterydoubleBattery level.
cellIdNSIntegerCell ID.
comProtocolVerNSStringCommunication protocol version.
dataProtocolVerNSStringData protocol version.
deviceKeyNSStringDeviceKey.
iccidNSStringICCID.
lacNSIntegerLocation Area Code.
locatorNSStringSupported positioning method.
mccNSStringMobile Country Code.
mcuVersionNSStringMCU version.
memoryFreeNSIntegerAvailable storage space.
mncNSIntegerMobile Network Code.
phoneNumNSStringMobile phone number.
productKeyNSStringProductKey.
rsrpNSIntegerReference Signal Received Power.
rsrqNSIntegerLTE Reference Signal Received Quality.
sdkVersionNSStringSDK version.
simNSStringSIM card number.
snrNSIntegerSignal-to-Noise Ratio.
typeNSStringModule model.
versionNSStringModule firmware version.
voltagedoubleVoltage.

QuecProductTSLResourceInfoModel Definition

FieldTypeDescription
deviceKeyNSStringDeviceKey.
createTimeNSStringCreation time.
deviceIdNSStringDevice ID.
resourceCodeNSStringResource code.
resourceValueNSStringResource value.
updateTimeNSStringUpdate time.

Example

objc
[QuecDeviceService.sharedInstance getDeviceBusinessAttributesWithProductKey:@"productKey" deviceKey:@"deviceKey" gatewayPk:@"" gatewayDk:@"" codeList:@"" type:@"1" success:^(QuecProductTSLInfoModel *tslInfoModel) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Enable/Disable Device Offline Notification

API

Enable or disable the device offline notification.

objc
- (void)setOfflineReminderWithProductKey:(NSString *)productKey 
                                 deviceKey:(NSString *)deviceKey
                    enableOfflineReminder:(int)enableOfflineReminder
                                   success:(QuecVoidBlock)success
                                   failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
enableOfflineReminderY0: Disable
1: Enable
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[[QuecDeviceService sharedInstance] setOfflineReminderWithProductKey:@"productKey" deviceKey:@"deviceKey" enableOfflineReminder:enable success:^{
       /// Next Action
   } failure:^(NSError *error) {
       NSLog(@"check error: %@", error);
   }];

Get Enablement Status of Offline Notification

API

Get the enablement status of the device offline notification.

objc
- (void)getOfflineReminderWithProductKey:(NSString *)productKey 
                                 deviceKey:(NSString *)deviceKey
                                   success:(void(^)(int enableOfflineReminder))success
                                   failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[[QuecDeviceService sharedInstance] getOfflineReminderWithProductKey:@"productKey" deviceKey:@"deviceKey" success:^(int enableOfflineReminder) {
       /// Next Action
   } failure:^(NSError *error) {
       NSLog(@"check error: %@", error);
   }];

Set Device Timezone

API

Set the device timezone, used for synchronizing the device's time zone with the app's set time zone.

objc
- (void)setDeviceTimeZoneWithProductKey:(NSString *)productKey 
                                deviceKey:(NSString *)deviceKey
                                 timeZone:(NSString *)timeZone
                                 timeZoneId:(NSString *)timeZoneId
                                  success:(QuecVoidBlock)success
                                  failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
timeZoneYTimezone. Format: GMT+-HH:mm or GMT+-HH.
timeZoneIdYTimezone ID.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[[QuecDeviceService sharedInstance] setDeviceTimeZoneWithProductKey:@"productKey" deviceKey:@"deviceKey" timeZone:@"GMT+08:00" timeZoneId:[NSTimeZone localTimeZone].name success:^{
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Get Device Timezone

API

Get the current device time zone.

objc
- (void)getDeviceTimeZoneWithProductKey:(NSString *)productKey 
                                deviceKey:(NSString *)deviceKey
                                  success:(void(^)(QuecDeviceTimeZoneModel *model))success
                                  failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecDeviceTimeZoneModel Definition

FieldTypeDescription
timeZoneNSStringDevice timezone.
timeZoneIdNSStringTimezone ID.

Example

objc
[QuecDeviceService.sharedInstance getDeviceTimeZoneWithProductKey:@"productKey" deviceKey:@"deviceKey" success:^(QuecDeviceTimeZoneModel *model) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Get Product Manual

API

Get a product manual.

objc
- (void)getProductDescriptionWithProductKey:(NSString *)productKey 
                                      success:(void(^)(NSString *url))success
                                      failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
productKeyYProductKey.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[QuecDeviceService.sharedInstance getProductDescriptionWithProductKey:@"productKey" success:^(NSString *url) {
        if (url) {
            /// Next Action
        }
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Query Device Reset Credentials

API

Query the reset credential of a Bluetooth-only device, which can be used for device reset in the platform.

objc
- (void)getPureBtResetCredentialsWithDeviceList:(NSArray<QuecPureBtResetEnterModel *> *)deviceList
                                            success:(void(^)(QuecPureBtResetModel *model))success
                                            failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
deviceListYQuecPureBtResetEnterModel array of the devices to be queried.
successNCallback function of successful request.
failureNCallback function of failed request.

QuecPureBtResetEnterModel Definition

FieldTypeDescription
pkNSStringProductKey.
dkNSStringDeviceKey.

QuecPureBtResetModel Definition

FieldTypeDescription
successListNSArray<QuecPureBtResetCredentialsModel *> *List of successful executions.
failureListNSArray<QuecPureBtResetCredentialsModel *> *List of failed executions.

QuecPureBtResetCredentialsModel Definition

FieldTypeDescription
pkNSStringProductKey.
dkNSStringDeviceKey.
resetCredentialsNSStringBluetooth-only device reset credentials (Only valid for successList).
msgNSStringError message (Only valid for failureList).

Example

objc
QuecPureBtResetEnterModel *resetModel = QuecPureBtResetEnterModel.new;
resetModel.pk = @"pk";
resetModel.dk = @"dk";
[QuecDeviceService.sharedInstance getPureBtResetCredentialsWithDeviceList:@[resetModel] success:^(QuecPureBtResetModel *model) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Unbind Device

API

Unbind a device.

objc
- (void)unbindDeviceWithDeviceKey:(NSString *)deviceKey
                        productKey:(NSString *)productKey
                            isInit:(BOOL)isInit
                            random:(NSString *)random
                 resetCredentials:(NSString *)resetCredentials
                           success:(QuecVoidBlock)success
                           failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
deviceKeyYDeviceKey.
productKeyYProductKey.
isInitNWhether initialization is required. Default value: false. (This parameter is required for Bluetooth-only devices)
randomN(This parameter is required for Bluetooth-only devices)
resetCredentialsNBluetooth-only device reset credentials (This parameter is required for Bluetooth-only devices)
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[QuecDeviceService.sharedInstance unbindDeviceWithDeviceKey:@"deviceKey"
                                                         productKey:@"productKey"
                                                             isInit:NO
                                                             random:@""
                                                   resetCredentials:@"" success:^{
            /// Next Action
        } failure:^(NSError *error) {
            NSLog(@"check error: %@", error);
        }];

Unbind Device in Batches

API

Unbind devices in batches.

objc
- (void)batchUnbindDeviceWithIsInit:(BOOL)isInit
                          deviceList:(NSArray<QuecDeviceModel *> *)deviceList
                             success:(void(^)(QuecBatchUnbindModel *model))success
                             failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
isInitNWhether initialization is required. Default value: false.
deviceListYQuecDeviceModel array.
successNCallback function of successful request.
failureNCallback function of failed request.

See QuecDeviceModel Definition above.

QuecBatchUnbindModel Definition

FieldTypeDescription
successListNSArray<QuecBatchUnbindDeviceModel *> *List of successful executions.
failListNSArray<QuecBatchUnbindDeviceModel *> *List of failed executions.

QuecBatchUnbindDeviceModel Definition

FieldTypeDescription
pkNSStringProductKey.
dkNSStringDeviceKey.
gdidNSStringGroup ID.
shareCodeNSStringShare code.
bindingSumNSIntegerThe number of bound users of the device in the platform after the unbinding operation, including pseudo-binding.
codeNSIntegerError code (Only valid for failureList).
msgNSStringError message (Only valid for failureList).

Example

objc
[QuecDeviceService.sharedInstance batchUnbindDeviceWithIsInit:NO deviceList:@[deviceModel1, deviceModel2] success:^(QuecBatchUnbindModel *model) {
        /// Next Action
    } failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];

Generate AuthKey in Platform

API

Generate an AuthKey in the platform, primarily used when establishing a communication channel for devices that have been activated and connected to the platform but lack an AuthKey.

objc
- (void)regenerateAuthKeyWithDeviceKey:(NSString *)deviceKey
                            productKey:(NSString *)productKey
                               success:(QuecStringBlock)success
                               failure:(QuecErrorBlock)failure;

Parameter

ParameterRequiredDescription
deviceKeyYDeviceKey.
productKeyYProductKey.
successNCallback function of successful request.
failureNCallback function of failed request.

Example

objc
[[QuecDeviceService sharedInstance] regenerateAuthKeyWithDeviceKey:@"deviceKey" productKey:@"productKey" success:^(NSString *result) {
        /// Next Action
    } failure:} failure:^(NSError *error) {
        NSLog(@"check error: %@", error);
    }];