Beispiel #1
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()
Beispiel #3
0
    def testStartAndStopManagerNoComms(self):
        ddMgr = DeviceDataManager(enableMqtt=False, enableCoap=False)
        ddMgr.startManager()

        sleep(30)

        ddMgr.stopManager()
    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()
Beispiel #5
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()
Beispiel #7
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()
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...")
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...")