Exemple #1
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)
Exemple #3
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)
Exemple #4
0
 def clientInfo(self):
     clientInfo = ClientInfo()
     clientInfo.setPlatformIp((Constant().readConfFile())[0])
     clientInfo.setPlatformPort((Constant().readConfFile())[1])
     clientInfo.setAppId((Constant().readConfFile())[2])
     clientInfo.setSecret((Constant().readConfFile())[3])
     clientInfo = DictUtil.dto2dict(clientInfo)
     return clientInfo
Exemple #5
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)
Exemple #6
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)
Exemple #7
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)
Exemple #8
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)
Exemple #9
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)
Exemple #10
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)
Exemple #11
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)
Exemple #12
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)
Exemple #13
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)
Exemple #14
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)
    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)
Exemple #16
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)
 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)
 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)
 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)
Exemple #20
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)
Exemple #21
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)
Exemple #22
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)
Exemple #23
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)
Exemple #24
0
 def queryTaskDetails(self, qtdInDTO, accessToken):
     qtdInDTO = DictUtil.dto2dict(qtdInDTO)
     authUrl = RestConstant.QUERYTASKDETAILS + str(qtdInDTO['taskId'])
     for key in qtdInDTO.keys():
         if key == 'taskId':
             authUrl = authUrl
         elif qtdInDTO[key] != None:
             authUrl += "&" + key + "=" + qtdInDTO[key]
     logging.info(qtdInDTO), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, None,
                                     accessToken)
Exemple #25
0
 def updateDeviceCommand(self, udcInDTO, deviceCommandId, appId,
                         accessToken):
     udcInDTO = DictUtil.dto2dict(udcInDTO)
     authUrl = RestConstant.UPDATE_DEVICE_COMMAND + deviceCommandId
     if appId != None:
         authUrl += "?appId=" + appId
     payload = json.dumps(udcInDTO)
     logging.info(udcInDTO), logging.info(deviceCommandId), logging.info(
         appId), logging.info(accessToken)
     return NorthApiClient.invokeAPI(RestConstant.HTTPPUT, authUrl, payload,
                                     accessToken)
Exemple #26
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)
Exemple #27
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)
Exemple #28
0
	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)