def __init__(self):
     """
     Initialization of class.
     
     @param path The name of the resource to apply to the URI.
     """
     logging.info("Initializing CDA...")
     self.devDataManager = DeviceDataManager()
    def __init__(self):
        """
		Initialization of class.
		
		Create DeviceDataManager instance.
		"""
        logging.info("Initializing CDA...")
        self.devDataManager = DeviceDataManager()
Esempio n. 3
0
    def __init__(self):
        """
		Initialization of class.
		Create an instance of SystemPerformanceManager
		
		@param path The name of the resource to apply to the URI.
		"""
        logging.info("Initializing CDA...")
        self.devDataMgr = DeviceDataManager()
    def testActuatorDataCallback(self):
        ddMgr = DeviceDataManager()

        actuatorData = ActuatorData(typeID=ConfigConst.HVAC_ACTUATOR_TYPE)
        actuatorData.setCommand(ConfigConst.COMMAND_ON)
        actuatorData.setStateData("This is a test.")

        ddMgr.handleActuatorCommandMessage(actuatorData)

        sleep(10)
    def testStartAndStopManagerWithMqttAndCoap(self):
        ddMgr = DeviceDataManager(enableMqtt=False, enableCoap=False)

        actuatorData = ActuatorData(
            actuatorType=ActuatorData.HVAC_ACTUATOR_TYPE)
        actuatorData.setCommand(ActuatorData.COMMAND_ON)
        actuatorData.setStateData("This is a test.")

        ddMgr.handleActuatorCommandMessage(actuatorData)

        sleep(10)
class ConstrainedDeviceApp():
    """
	Definition of the ConstrainedDeviceApp class.
	
	"""
    def __init__(self):
        """
		Initialization of class.
		
		@param path The name of the resource to apply to the URI.
		"""
        self.sysPerfManager = SystemPerformanceManager()

        logging.info("Initializing CDA...")
        self.devDataManager = DeviceDataManager()

    def startApp(self):
        """
		Start the CDA. Calls startManager() on the device data manager instance.
		
		"""
        self.sysPerfManager.startManager()
        logging.info("Starting CDA...")
        self.devDataManager.startManager()
        logging.info("CDA started.")

    def stopApp(self, code: int):
        """
		Stop the CDA. Calls stopManager() on the device data manager instance.
		
		"""
        self.sysPerfManager.stopManager()
        logging.info("CDA stopping...")
        self.devDataManager.stopManager()
        logging.info("CDA stopped with exit code %s.", str(code))

    def parseArgs(self, args):
        """
		Parse command line args.
		
		@param args The arguments to parse.
		"""
        logging.info("Parsing command line args...")
Esempio n. 7
0
    def testStartAndStopManagerWithMqttAndCoap(self):
        ddMgr = DeviceDataManager(enableMqtt=True, enableCoap=True)
        ddMgr.startManager()

        sleep(600000)

        ddMgr.stopManager()
    def testStartAndStopManagerWithMqtt(self):
        """
		NOTE: Be sure to enable CoAP by setting the following flag to True
		within PiotConfig.props
		enableMqttClient = True
		enableCoapClient = False
		
		"""
        ddMgr = DeviceDataManager()
        ddMgr.startManager()

        mqttClient = MqttClientConnector()
        mqttClient.connectClient()

        ad = ActuatorData()
        ad.setCommand(1)

        adJson = DataUtil().actuatorDataToJson(ad)

        mqttClient.publishMessage(ResourceNameEnum.CDA_ACTUATOR_CMD_RESOURCE,
                                  msg=adJson,
                                  qos=1)

        sleep(10)

        mqttClient.disconnectClient()
        ddMgr.stopManager()
Esempio n. 9
0
    def testStartAndStopManagerNoComms(self):
        ddMgr = DeviceDataManager(enableMqtt=False, enableCoap=False)
        ddMgr.startManager()

        sleep(30)

        ddMgr.stopManager()
class ConstrainedDeviceApp():
    """
	Definition of the ConstrainedDeviceApp class.
	
	"""
    def __init__(self):
        """
		Initialization of class.
		
		Create DeviceDataManager instance.
		"""
        logging.info("Initializing CDA...")
        self.devDataManager = DeviceDataManager()

    def startApp(self):
        """
		Start the CDA:
		Start DeviceDataManager.
		"""
        logging.info("Starting CDA...")
        self.devDataManager.startManager()
        logging.info("CDA started.")

    def stopApp(self, code: int):
        """
		Stop the CDA.
		Stop DeviceDataManager.
		"""
        logging.info("CDA stopping...")
        self.devDataManager.stopManager()
        logging.info("CDA stopped with exit code %s.", str(code))

    def parseArgs(self, args):
        """
		Parse command line args.
		
		@param args The arguments to parse.
		"""
        logging.info("Parsing command line args...")
    def testDeviceDataManagerIntegration(self):
        ddMgr = DeviceDataManager(enableMqtt=True, enableCoap=False)
        ddMgr.startManager()

        # 5 min's should be long enough to run the tests and manually adjust the emulator values
        sleep(300)

        ddMgr.stopManager()
Esempio n. 12
0
    def testDeviceDataManagerIntegration(self):
        # TODO: set either MQTT or CoAP to True - you'll only need one.
        ddMgr = DeviceDataManager(enableMqtt=True, enableCoap=False)
        ddMgr.startManager()

        # 5 min's should be long enough to run the tests and manually adjust the emulator values
        sleep(300)

        ddMgr.stopManager()
    def testStartAndStopManagerWithCoap(self):
        """
		NOTE: Be sure to enable CoAP by setting the following flag to True
		within PiotConfig.props
		enableMqttClient = False
		enableCoapClient = True
		
		"""

        ddMgr = DeviceDataManager()
        ddMgr.startManager()

        sleep(60)

        ddMgr.stopManager()
Esempio n. 14
0
	def testStartAndStopManagerNoComms(self):
		"""
		NOTE: Be sure to disable MQTT and CoAP by setting the following flags to False
		within PiotConfig.props
		enableMqttClient = False
		enableCoapClient = False
		
		"""
		
		ddMgr = DeviceDataManager()
		ddMgr.startManager()
		
		sleep(120) # 2 minutes
		
		ddMgr.stopManager()