def toSensorfromJson(self, jsonData):
        sdDict = json.loads(jsonData)

        sd = SensorData('Temperature', 0, 30)
        sd.name = sdDict['name']
        sd.timeStamp = sdDict['timeStamp']
        sd.avgVal = sdDict['avgVal']
        sd.minVal = sdDict['minVal']
        sd.maxVal = sdDict['maxVal']
        sd.curVal = sdDict['curVal']

        return sd
Exemplo n.º 2
0
 def toSensorDataFromJson(self, jsonData):
     sdDict = json.loads(jsonData)
     sd = SensorData()
     sd.name = sdDict['name']
     sd.timeStamp = sdDict['timeStamp']
     sd.avgValue = sdDict['avgValue']
     sd.minValue = sdDict['minValue']
     sd.maxValue = sdDict['maxValue']
     sd.curValue = sdDict['curValue']
     sd.totValue = sdDict['totValue']
     sd.sampleCount = sdDict['sampleCount']
     
     return sd 
 def toSensorDataFromJson(self, string):
     act = SensorData()
     data = json.loads(string)
     logging.info(data)
     act.name = data['name']
     act.reading_number = data['reading_number']
     act.current = data['current']
     act.min_value = data['min_value']
     act.max_value = data['max_value']
     act.total_value = data['total_value']
     act.timestamp = data['timestamp']
     logging.info("New actuator generated from JSon \n")
     return act
Exemplo n.º 4
0
 def jsonTosensor(self,jsonData):
     sensedataDict = json.loads(jsonData)
     print(" decode [pre] --> " + str(sensedataDict))
     sensedata = SensorData('Temperature',0,30)
     sensedata.name = sensedataDict['name']
     sensedata.timeStamp = sensedataDict['timeStamp']
     sensedata.avgVal = sensedataDict['avgVal']
     sensedata.minVal = sensedataDict['minVal']
     sensedata.maxVal = sensedataDict['maxVal']
     sensedata.curVal = sensedataDict['curVal']
     sensedata.totValue = sensedataDict['totValue']
     sensedata.sampleCount = sensedataDict['sampleCount']
     print(" decode [post] --> " + str(sensedata))
     return sensedata
Exemplo n.º 5
0
    def jsonToSensorData(self, jsonData):
        sdDict = json.loads(jsonData)

        #print(" decode [pre] --> " + str(sdDict))

        sd = SensorData("Temperature Sensor", 0.0, 30.0)
        sd.name = sdDict['name']
        sd.timeStamp = sdDict['time']
        sd.avgValue = sdDict['avgValue']
        sd.minValue = sdDict['minValue']
        sd.maxValue = sdDict['maxValue']
        sd.curValue = sdDict['curValue']

        #print(" decode [post] --> " + str(sd))

        return sd
Exemplo n.º 6
0
 def toSensorDataFromJson(self,jsonData):
     sdDict = json.loads(jsonData)
     print(" decode [pre] --> " + str(sdDict))
     
     sd              = SensorData()
     sd.name         = sdDict['name']
     sd.timeStamp    = sdDict['timeStamp']
     sd.avgValue     = sdDict['avgValue']
     sd.minValue     = sdDict['minValue']
     sd.maxValue     = sdDict['maxValue']
     sd.curValue     = sdDict['curValue']
     sd.totValue     = sdDict['totValue']
     sd.sampleCount  = sdDict['sampleCount']
     
     print(" decode [post] --> " + str(sd))
     
     return sd