示例#1
0
    def queryBatchDevicesInfo(self, qbdiInDTO, accessToken):
        qbdiInDTO = DictUtil.dto2dict(qbdiInDTO)
        authUrl = RestConstant.QUERY_BATCH_DEVICES_INFO
        for key in qbdiInDTO.keys():
            if qbdiInDTO[key] != None:
                authUrl += "&" + key + "=" + qbdiInDTO[key]
        logging.info(qbdiInDTO), logging.info(accessToken)
        return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None, accessToken)
		
	def queryDeviceDataHistory(self, qddhInDTO, accessToken):
        authUrl = "/iocm/app/data/v1.2.0/deviceDataHistory"
        payload = DictUtil.dto2dict(qddhInDTO)
		logging.info(qddhInDTO), logging.info(accessToken), logging.info(payload)
        return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, payload, accessToken)
示例#2
0
 def createFirmwareUpgradeTask(self, cutInDTO, accessToken):
     cutInDTO = DictUtil.dto2dict(cutInDTO)
     authUrl = RestConstant.CREATE_FIRMWARE_UPGRADE_TASK
     payload = json.dumps(cutInDTO)
     logging.info(cutInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPOST, authUrl,
                                     payload, accessToken)
 def subDeviceManagementData(self, sdmdInDTO, accessToken):
     sdmdInDTO = DictUtil.dto2dict(sdmdInDTO)
     authUrl = RestConstant.SUB_DEVICE_MANAGEMENT_DATA
     payload = json.dumps(sdmdInDTO)
     logging.info(sdmdInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPOST, authUrl,
                                     payload, accessToken)
示例#4
0
 def refreshAuthToken(self, arInDTO):
     arInDTO = DictUtil.dto2dict(arInDTO)
     authUrl = RestConstant.REFRESH_TOKEN
     payload = json.dumps(arInDTO)
     logging.info(arInDTO), logging.info(payload)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPOST, authUrl,
                                     payload, None)
示例#5
0
 def deleteRule(self, ruleId, appId, accessToken):
     authUrl = RestConstant.DELETE_RULE + ruleId
     if appId != None:
         authUrl += "?appId=" + appId
     logging.info(ruleId), logging.info(appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPDELETE, authUrl, None,
                                     accessToken)
示例#6
0
 def queryDeviceShadow(self, deviceId, appId, accessToken):
     authUrl = RestConstant.QUERY_DEVICE_SHADOW + deviceId
     if appId != None:
         authUrl += "?appId=" + appId
     logging.info(deviceId), logging.info(appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None,
                                     accessToken)
示例#7
0
 def queryDeviceCapabilities(self, qdcInDTO, accessToken):
     qdcInDTO = DictUtil.dto2dict(qdcInDTO)
     authUrl = RestConstant.QUERY_DEVICE_CAPABILITIES
     for key in qdcInDTO.keys():
         if qdcInDTO[key] != None:
             authUrl += "&" + key + "=" + qdcInDTO[key]
     logging.info(qdcInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None, accessToken)
 def deleteSingleSubscription(self, subscriptionId, appId, accessToken):
     authUrl = RestConstant.DELETE_SINGLE_SUB_SCRIPTION + subscriptionId
     if appId != None:
         authUrl += "?appId=" + appId
     logging.info(subscriptionId), logging.info(appId), logging.info(
         accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPDELETE, authUrl, None,
                                     accessToken)
示例#9
0
 def querySingleDeviceInfo(self, deviceId, select, appId, accessToken):
     authUrl = RestConstant.QUERY_SINGLE_DEVICE_INFO + deviceId + "?"
     if appId != None:
         authUrl += "appId=" + appId
     if select != None:
         authUrl += "&select=" + select
     logging.info(deviceId), logging.info(select), logging.info(appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None, accessToken)
示例#10
0
 def createBatchTask(self, btcInDTO, accessToken):
     btcInDTO = DictUtil.dto2dict(btcInDTO)
     authUrl = RestConstant.CREATE_BATCH_TASK
     payload = json.dumps(btcInDTO)
     logging.info(btcInDTO), logging.info(accessToken), logging.info(
         payload)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPOST, authUrl,
                                     payload, accessToken)
示例#11
0
 def queryDeviceRealtimeLocation(self, qdrlInDTO, appId, accessToken):
     qdrlInDTO = DictUtil.dto2dict(qdrlInDTO)
     authUrl = RestConstant.QUERY_DEVICE_REALTIME_LOCATION
     if appId != None:
         authUrl += "?appId=" + appId
     payload = json.dumps(qdrlInDTO)
     logging.info(qdrlInDTO), logging.info(appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPOST, authUrl,
                                     payload, accessToken)
示例#12
0
 def refreshDeviceKey(self, rdkInDTO, appId, accessToken):
     rdkInDTO = DictUtil.dto2dict(rdkInDTO)
     authUrl = RestConstant.REFRESH_DEVICE_KEY + rdkInDTO['deviceId']
     if appId != None:
         authUrl += "?appId=" + appId
     payload = json.dumps(rdkInDTO)
     logging.info(rdkInDTO), logging.info(appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPUT, authUrl, payload,
                                     accessToken)
示例#13
0
 def regDirectDevice(self, rddInDto, appId, accessToken):
     rddInDto = DictUtil.dto2dict(rddInDto)
     authUrl = RestConstant.REG_DIRECT_DEVICE
     if appId != None:
         authUrl += "?appId=" + appId
     payload = json.dumps(rddInDto)
     logging.info(rddInDto), logging.info(appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPOST, authUrl,
                                     payload, accessToken)
示例#14
0
 def updateBatchRuleStatus(self, ubrsInDTO, appId, accessToken):
     ubrsInDTO = DictUtil.dto2dict(ubrsInDTO)
     authUrl = RestConstant.UPDATE_BATCH_RULE_STATUS
     if appId != None:
         authUrl += "?appId=" + appId
     payload = json.dumps(ubrsInDTO)
     logging.info(ubrsInDTO), logging.info(appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPUT, authUrl, payload,
                                     accessToken)
示例#15
0
 def updateRuleStatus(self, ursInDTO, appId, accessToken):
     ursInDTO = DictUtil.dto2dict(ursInDTO)
     authUrl = RestConstant.UPDATE_RULE_STATUS + ursInDTO[
         'ruleId'] + "/status/" + ursInDTO['status']
     if appId != None:
         authUrl += "?appId=" + appId
     logging.info(ursInDTO), logging.info(appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPUT, authUrl, None,
                                     accessToken)
示例#16
0
 def queryDeviceCmdCancelTask(self, qdcctInDTO, accessToken):
     qdcctInDTO = DictUtil.dto2dict(qdcctInDTO)
     authUrl = RestConstant.QUERY_DEVICE_CMD_CANCEL_TASK
     for key in qdcctInDTO.keys():
         if qdcctInDTO[key] != None:
             authUrl += "&" + key + "=" + qdcctInDTO[key]
     logging.info(qdcctInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None,
                                     accessToken)
示例#17
0
    def invokeDeviceService(self, commandDTO, deviceId, serviceId, appId, accessToken):
        commandDTO = DictUtil.dto2dict(commandDTO)
        authUrl = RestConstant.INVOKE_DEVICE_SERVICE + deviceId + "/services/" + serviceId + "/sendCommand"
        if appId != None:
            authUrl += "?appId=" + appId

        payload = json.dumps(commandDTO)
        logging.info(commandDTO), logging.info(deviceId), logging.info(appId), logging.info(accessToken)
        return NorthApiClient.invokeAPI(RestConstant.HTTPPOST, authUrl, payload, accessToken)
示例#18
0
 def updateRule(self, ruleDTO, appId, accessToken):
     ruleDTO = DictUtil.dto2dict(ruleDTO)
     authUrl = RestConstant.UPDATE_RULE
     if appId != None:
         authUrl += "?appId=" + appId
     payload = json.dumps(ruleDTO)
     logging.info(ruleDTO), logging.info(appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPUT, authUrl, payload,
                                     accessToken)
示例#19
0
 def postDeviceCommand(self, pdcInDTO, appId, accessToken):
     pdcInDTO = DictUtil.dto2dict(pdcInDTO)
     authUrl = RestConstant.POST_DEVICE_COMMAND
     if appId != None:
         authUrl += "?appId=" + appId
     payload = json.dumps(pdcInDTO)
     logging.info(pdcInDTO), logging.info(appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPOST, authUrl,
                                     payload, accessToken)
示例#20
0
 def queryDeviceDesiredHistory(self, qddhInDTO, accessToken):
     qddhInDTO = DictUtil.dto2dict(qddhInDTO)
     authUrl = RestConstant.QUERY_DEVICE_DESIRED_HISTORY + qddhInDTO['deviceId'] + "&gatewayId=" + qddhInDTO[
         'gatewayId']
     for key in qddhInDTO.keys():
         if qddhInDTO[key] != None:
             authUrl += "&" + key + "=" + qddhInDTO[key]
     logging.info(qddhInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None, accessToken)
示例#21
0
 def queryBatchSubscriptions(self, qbsInDTO, accessToken):
     qbsInDTO = DictUtil.dto2dict(qbsInDTO)
     authUrl = RestConstant.QUERY_BATCH_SUB_SCRIPTIONS
     for key in qbsInDTO.keys():
         if qbsInDTO[key] != None:
             authUrl += "&" + key + "=" + qbsInDTO[key]
     logging.info(qbsInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None,
                                     accessToken)
示例#22
0
 def deleteBatchSubscriptions(self, dbsInDTO, accessToken):
     dbsInDTO = DictUtil.dto2dict(dbsInDTO)
     authUrl = RestConstant.DELETE_BATCH_SUB_SCRIPTIONS
     for key in dbsInDTO.keys():
         if dbsInDTO[key] != None:
             authUrl += "&" + key + "=" + dbsInDTO[key]
     logging.info(dbsInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPDELETE, authUrl, None,
                                     accessToken)
示例#23
0
 def subDeviceBusinessData(self, sdbdInDTO, accessToken):
     sdbdInDTO = DictUtil.dto2dict(sdbdInDTO)
     authUrl = RestConstant.SUB_DEVICE_BUSINESS_DATA
     if sdbdInDTO['ownerFlag'] != None:
         authUrl += "?ownerFlag=" + sdbdInDTO['ownerFlag']
     payload = json.dumps(sdbdInDTO)
     logging.info(sdbdInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPOST, authUrl,
                                     payload, accessToken)
示例#24
0
 def queryUpgradeTaskList(self, qutlInDTO, accessToken):
     qutlInDTO = DictUtil.dto2dict(qutlInDTO)
     authUrl = RestConstant.QUERY_UPGRADE_TASK_LIST
     for key in qutlInDTO.keys():
         if qutlInDTO[key] != None:
             authUrl += "&" + key + "=" + qutlInDTO[key]
     logging.info(qutlInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None,
                                     accessToken)
示例#25
0
 def queryUpgradeSubTask(self, qustInDTO, operationId, accessToken):
     qustInDTO = DictUtil.dto2dict(qustInDTO)
     authUrl = RestConstant.QUERY_UPGRADE_SUB_TASK + operationId + "/subOperations?"
     for key in qustInDTO.keys():
         if qustInDTO[key] != None:
             authUrl += "&" + key + "=" + qustInDTO[key]
     logging.info(qustInDTO), logging.info(operationId), logging.info(
         accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None,
                                     accessToken)
示例#26
0
 def queryOneTask(self, taskId, select, appId, accessToken):
     authUrl = RestConstant.CREATE_BATCH_TASK + taskId + "?"
     if appId != None:
         authUrl += "appId=" + appId
     if select != None:
         authUrl += "&select=" + select
     logging.info(taskId), logging.info(select), logging.info(
         appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None,
                                     accessToken)
示例#27
0
 def deleteDirectDevice(self, deviceId, cascade, appId, accessToken):
     authUrl = RestConstant.MODIFY_DEVICE_INFO + deviceId + "?"
     if appId != None:
         authUrl += "&appId=" + appId
     if cascade != None:
         authUrl += "&cascade=" + cascade
     logging.info(deviceId), logging.info(cascade), logging.info(
         appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPDELETE, authUrl, None,
                                     accessToken)
示例#28
0
 def modifyDeviceShadow(self, mdsInDTO, deviceId, appId, accessToken):
     mdsInDTO = DictUtil.dto2dict(mdsInDTO)
     authUrl = RestConstant.MODIFY_DEVICE_SHADOW + deviceId
     if appId != None:
         authUrl += "?appId=" + appId
     payload = json.dumps(mdsInDTO)
     logging.info(mdsInDTO), logging.info(deviceId), logging.info(
         appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPUT, authUrl, payload,
                                     accessToken)
示例#29
0
 def createDeviceCmdCancelTask(self, cdcctInDTO, appId, accessToken):
     cdcctInDTO = DictUtil.dto2dict(cdcctInDTO)
     authUrl = RestConstant.CREATE_DEVICE_CMD_CANCEL_TASK
     if appId != None:
         authUrl += "?appId=" + appId
     payload = json.dumps(cdcctInDTO)
     logging.info(cdcctInDTO), logging.info(appId), logging.info(
         accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPOST, authUrl,
                                     payload, accessToken)
示例#30
0
 def queryRules(self, qrInDTO, accessToken):
     qrInDTO = DictUtil.dto2dict(qrInDTO)
     authUrl = RestConstant.QUERY_RULES + qrInDTO['author']
     for key in qrInDTO.keys():
         if key == 'author':
             authUrl = authUrl
         elif qrInDTO[key] != None:
             authUrl += "&" + key + "=" + qrInDTO[key]
     logging.info(qrInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None,
                                     accessToken)