Skip to content

Device Management

Feature Description

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

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.

kotlin
fun getDeviceList(params: QuecDeviceListParamsModel, callback: QuecCallback<QuecPageResponse<QuecDeviceModel>>)

Parameter

ParameterRequiredDescription
paramsYQuecDeviceListParamsModel class.
callbackYCallback function of the request.

QuecDeviceListParamsModel Definition

FieldTypeDescription
pageNumberintPage number. (Required)
pageSizeintPage size. (Required)
isAssociationbooleanDevice association management parameter. (Optional)
secondItemCodeStringSecondary category parameter. (Optional)
pkListStringProductKey list, separated by commas. (Optional)
deviceNameStringDevice name - used for searching devices. (Optional)

See QuecDeviceModel Definition above.

Example

kotlin
QuecDeviceService.getDeviceList(QuecDeviceListParamsModel(1, 10, true, null, null, null)) {
    if (it.isSuccess) {
        val data = it.data //Get a list of devices successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Edit Device Name

API

Edit a device name.

kotlin
fun updateDeviceName(
    deviceName: String,
    productKey: String,
    deviceKey: String,
    callback: QuecCallback<Unit>
)

Parameter

ParameterRequiredDescription
deviceNameYDevice name.
productKeyYProductKey.
deviceKeyYDeviceKey.
callbackYCallback function of the request.

Example

kotlin
QuecDeviceService.updateDeviceName("newName", "pk", "dk") {
    if (it.isSuccess) {
        //Edit a device name successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Get Device Details

API

Get device details.

kotlin
fun getDeviceInfoByDeviceKey(
    deviceKey: String,
    productKey: String,
    callback: QuecCallback<QuecDeviceModel>
)

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
callbackYCallback function of the request.

See QuecDeviceModel Definition above.

Example

kotlin
QuecDeviceService.getDeviceInfoByDeviceKey("dk", "pk") {
    if (it.isSuccess) {
        val data = it.data //Get device details successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Get Device TSL and Business Property

API

Get the device TSL model and business properties.

kotlin
fun getProductTslAndDeviceBusinessAttributes(
    productKey: String,
    deviceKey: String,
    gatewayPk: String?,
    gatewayDk: String?,
    codeList: String?,
    type: String?,
    callback: IDeviceTSLModelCallback
)

IDeviceTSLModelCallback Definition

kotlin
public interface IDeviceTSLModelCallback {
    void onResultCallback(List<QuecProductTSLPropertyModel<?>> list);
    void onFail(Throwable throwable);
}

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
callbackYCallback function of the request.

QuecProductTSLPropertyModel Definition

FieldTypeDescription
specsList<QuecProductTSLSpecModel>TSL data.
formatSpecsList<QuecProductTSLSpecModel>TSL data, the same as specs.
dataTypeStringData type.
attributeValueStringProperty value.
codeStringCode.
nameStringName.
subTypeStringRead/Write type.
itemIdintID.
sortStringOrder.
typeStringType.
descStringDescription.

QuecProductTSLSpecModel Definition

FieldTypeDescription
specsList<QuecProductTSLSpecModel>Nested TSL data.
formatSpecsList<QuecProductTSLSpecModel>Nested TSL data, the same as specs.
dataTypeStringData type.
codeStringCode.
nameStringName.
valueStringValue.
itemIdintID.
unitStringUnit.
minStringMinimum.
maxStringMaximum.
stepStringStep.
lengthStringText length.
sizeStringArray size.
attributeValueidProperty value.

Example

kotlin
QuecDeviceService.getProductTslAndDeviceBusinessAttributes(
    "pk", "dk", null, null, null, null, object : IDeviceTSLModelCallback {
        override fun onResultCallback(list: MutableList<QuecProductTSLPropertyModel<*>>?) {
            //Get the device TSL model and business properties successfully.
        }
        override fun onFail(throwable: Throwable?) {
            //Failed.
        }
    })

Get Device TSL Model

API

Get the device TSL model.

kotlin
fun getProductTSL(
    productKey: String, callback: IDeviceTSLCallBack
)

IDeviceTSLCallBack Definition

kotlin
public interface IDeviceTSLCallBack {
    void onSuccess(List<ModelBasic> modelBasicList, List<TSLEvent> tslEventList, List<TSLService> tslServiceList);
 
    void onFail(Throwable throwable);
}

Parameter

ParameterRequiredDescription
productKeyYProductKey.
callbackYCallback function of the request.

QuecProductTSLModel Definition

FieldTypeDescription
profileQuecProductTSLProfileModelProfile information
propertiesList<QuecProductTSLPropertyModel>Property. Item: QuecProductTSLPropertyModel.
servicesList<QuecProductTSLServiceModel>Service. Item: QuecProductTSLServiceModel.
eventsList<QuecProductTSLEventModel>Event. Item: QuecProductTSLEventModel.

QuecProductTSLProfileModel Definition

FieldTypeDescription
productKeyStringProductKey.
versionStringVersion.
tslVersionStringTSL 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

kotlin
QuecDeviceService.getProductTSL("pk", object : IDeviceTSLCallBack {
    override fun onSuccess(
        modelBasicList: MutableList<ModelBasic<Any>>?,
        tslEventList: MutableList<TSLEvent>?,
        tslServiceList: MutableList<TSLService>?
    ) {
        //Get the device TSL model successfully.
    }
    override fun onFail(throwable: Throwable?) {
        //Failed.
    }
})

Get Device Business Property

API

Get device business properties.

kotlin
fun getDeviceBusinessAttributes(
    productKey: String,
    deviceKey: String,
    gatewayPk: String?,
    gatewayDk: String?,
    codeList: String?,
    type: String?,
    callback: QuecCallback<QuecProductTSLInfoModel>
)

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
callbackYCallback function of the request.

QuecProductTSLInfoModel Definition

FieldTypeDescription
customizeTslInfoList<QuecProductTSLCustomInfoModel>Custom TSL model data reporting list.
deviceLocateInfoQuecProductTSLLocateInfoModelLocation information.
deviceDataQuecProductTSLDataModelDevice resource data.
tslResourcesInfoList<QuecProductTSLResourceInfoModel>Resource TSL model data.

QuecProductTSLCustomInfoModel Definition

FieldTypeDescription
abIdintFeature ID.
dataTypeStringData type.
nameStringFeature name.
resourceCodeStringFeature code.
resourceValueStringFeature value.
subTypeStringData operation type.
typeStringFeature type.

QuecProductTSLLocateInfoModel Definition

FieldTypeDescription
createTimedoubleCreation time.
deviceKeyStringDeviceKey.
hdopStringHorizontal Dilution of Precision (GPS accuracy indicator).
latStringLatitude.
lngStringLongitude.
productKeyStringProductKey.
latTypeStringLatitude hemisphere (N/S).
lngTypeStringLongitude hemisphere (W/E).
locateRawStringRaw positioning data.
locateStatusStringDifferential/non-differential positioning status.
locateTimeStringPositioning time.
locateTypeStringPositioning method type.
satellitesStringNumber of connected satellites.
bdLatStringLatitude in BD09 coordinate system.
bdLngStringLongitude in BD09 coordinate system.
gcjLatStringLatitude in GCJ coordinate system.
gcjLngStringLongitude in GCJ coordinate system.
wgsLatStringRaw GPS latitude (WGS84).
wgsLngStringRaw GPS longitude (WGS84).

QuecProductTSLDataModel Definition

FieldTypeDescription
batterydoubleBattery level.
cellIdintCell ID.
comProtocolVerStringCommunication protocol version.
dataProtocolVerStringData protocol version.
deviceKeyStringDeviceKey.
iccidStringICCID.
lacintLocation Area Code.
locatorStringSupported positioning method.
mccStringMobile Country Code.
mcuVersionStringMCU version.
memoryFreeintAvailable storage space.
mncintMobile Network Code.
phoneNumStringMobile phone number.
productKeyStringProductKey.
rsrpintReference Signal Received Power.
rsrqintLTE Reference Signal Received Quality.
sdkVersionStringSDK version.
simStringSIM card number.
snrintSignal-to-Noise Ratio.
typeStringModule model.
versionStringModule firmware version.
voltagedoubleVoltage.

QuecProductTSLResourceInfoModel Definition

FieldTypeDescription
deviceKeyStringDeviceKey.
createTimeStringCreation time.
deviceIdStringDevice ID.
resourceCodeStringResource code.
resourceValueStringResource value.
updateTimeStringUpdate time.

Example

kotlin
QuecDeviceService.getDeviceBusinessAttributes("pk", "dk", null, null, null, null) {
    if (it.isSuccess) {
        val data = it.data //Get device business properties successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Enable/Disable Device Offline Notification

API

Enable or disable the device offline notification.

kotlin
fun setOfflineReminder(
    productKey: String,
    deviceKey: String,
    enableOfflineReminder: Int,
    callback: QuecCallback<Unit>
)

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
enableOfflineReminderY0: Disable
1: Enable
callbackYCallback function of the request.

Example

kotlin
QuecDeviceService.setOfflineReminder("pk", "dk", 1) {
    if (it.isSuccess) {
        //Enable the device offline notification successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Get Enablement Status of Offline Notification

API

Get the enablement status of the device offline notification.

kotlin
fun getOfflineReminder(
    productKey: String,
    deviceKey: String,
    callback: QuecCallback<Int>
)

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
callbackYCallback function of the request.
0: Disabled
1: Enabled

Example

kotlin
QuecDeviceService.getOfflineReminder("pk", "dk") {
    if (it.isSuccess) {
        val data = it.data //Get the enablement status of the device offline notification successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Set Device Timezone

API

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

kotlin
fun setDeviceTimeZone(
    productKey: String,
    deviceKey: String,
    timeZone: String,
    timeZoneId: String?,
    callback: QuecCallback<Unit>
)

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
timeZoneYTimezone. Format: GMT+-HH:mm or GMT+-HH.
timeZoneIdYTimezone ID.
callbackYCallback function of the request.

Example

kotlin
QuecDeviceService.setDeviceTimeZone("pk", "dk", "GMT+08:00", TimeZone.getDefault().id) {
    if (it.isSuccess) {
        //Set the device timezone successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Get Device Timezone

API

Get the current device time zone.

kotlin
fun getDeviceTimeZone(
    productKey: String,
    deviceKey: String,
    callback: QuecCallback<QuecDeviceTimeZoneModel>
)

Parameter

ParameterRequiredDescription
productKeyYProductKey.
deviceKeyYDeviceKey.
callbackYCallback function of the request.

QuecDeviceTimeZoneModel Definition

FieldTypeDescription
timeZoneStringDevice timezone.
timeZoneIdStringTimezone ID.

Example

kotlin
QuecDeviceService.getDeviceTimeZone("pk", "dk") {
    if (it.isSuccess) {
        val data = it.data //Get the current device time zone successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Get Product Manual

API

Get a product manual.

kotlin
fun getProductDescription(
    productKey: String,
    callback: QuecCallback<String>
)

Parameter

ParameterRequiredDescription
productKeyYProductKey.
callbackYCallback function of the request.

Example

kotlin
QuecDeviceService.getProductDescription("pk") {
    if (it.isSuccess) {
        val data = it.data //Get a product manual successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Unbind Device

API

Unbind a device.

kotlin
fun unbindDevice(
    deviceKey: String,
    productKey: String,
    isInit: Boolean,
    random: String?,
    resetCredentials: String?,
    callback: QuecCallback<Unit>
)

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)
callbackYCallback function of the request.

Example

kotlin
QuecDeviceService.unbindDevice("dk", "pk", false, null, null) {
    if (it.isSuccess) {
        //Unbind a device successfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}

Unbind Device in Batches

API

Unbind devices in batches.

kotlin
fun batchUnbindDevice(
    isInit: Boolean,
    deviceList: List<QuecDeviceModel>,
    callback: QuecCallback<QuecBatchUnbindModel>
)

Parameter

ParameterRequiredDescription
isInitNWhether initialization is required. Default value: false.
deviceListYQuecDeviceModel array.
callbackYCallback function of the request.

See QuecDeviceModel Definition above.

QuecBatchUnbindModel Definition

FieldTypeDescription
successListList<QuecBatchUnbindDeviceModel>List of successful executions.
failListList<QuecBatchUnbindDeviceModel>List of failed executions.

QuecBatchUnbindDeviceModel Definition

FieldTypeDescription
pkStringProductKey.
dkStringDeviceKey.
gdidStringGroup ID.
shareCodeStringShare code.
bindingSumintThe number of bound users of the device in the platform after the unbinding operation, including pseudo-binding.
codeintError code (Only valid for failureList).
msgStringError message (Only valid for failureList).

Example

kotlin
QuecDeviceService.batchUnbindDevice(false, listOf(QuecDeviceModel("pk", "dk"))) {
    if (it.isSuccess) {
        val data = it.data //Unbind devices in batches successsfully.
    } else {
        val code = it.code //Failed. Error code.
        val msg = it.msg //Failed. Error message.
    }
}