예제 #1
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)
예제 #2
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)
예제 #3
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)
예제 #4
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)
예제 #5
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)
예제 #6
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)
예제 #7
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)
예제 #8
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)
예제 #9
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)
예제 #10
0
 def queryDeviceCommand(self, qdcInDTO, accessToken):
     qdcInDTO = DictUtil.dto2dict(qdcInDTO)
     authUrl = RestConstant.QUERY_DEVICE_COMMAND
     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)
예제 #11
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)
예제 #12
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)

        return NorthApiClient.invokeAPI(RestConstant.HTTPGET, authUrl, payload,
                                        accessToken)
예제 #13
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)
예제 #14
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)
예제 #15
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)
예제 #16
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)
예제 #17
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)
예제 #18
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)
예제 #19
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)
예제 #20
0
 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)
예제 #21
0
 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)