programming-the-iot / book-exercise-tasks

This repo is for issues / tasks ONLY. All programming and related exercises for each chapter of 'Programming the Internet of Things' are listed here.
Other
11 stars 12 forks source link

PIOT-CDA-02-003: Connect SystemPerformanceManager to ConstrainedDeviceApp #21

Open labbenchstudios opened 4 years ago

labbenchstudios commented 4 years ago

Description

Review the README

Estimated effort may vary greatly

Actions

NOTE: The implementation examples depicted here are only one way to implement the requirements listed. Your own implementation may vary of course.

NOTE 2: All of the following instructions relate to the ConstrainedDeviceApp.

def startApp(self): logging.info("Starting CDA...")

self.sysPerfMgr.startManager()

logging.info("CDA started.")

def stopApp(self, code: int): logging.info("CDA stopping...")

self.sysPerfMgr.stopManager()

logging.info("CDA stopped with exit code %s.", str(code))   

**Estimate**

- Small

**Tests**

- Integration tests (in ./src/test/python/programmingtheiot/part01/integration)
  - Run ./app/ConstrainedDeviceAppTest. Integration test should pass and generate output similar to the following:

Finding files... done. Importing test modules ... done.

2020-07-20 10:23:00,146:INFO:Initializing CDA... 2020-07-20 10:23:00,147:INFO:Loading configuration... 2020-07-20 10:23:00,260:INFO:Starting CDA... 2020-07-20 10:23:00,260:INFO:Started SystemPerformanceManager. 2020-07-20 10:23:00,260:INFO:CDA started. 2020-07-20 10:23:00,260:INFO:CDA stopping... 2020-07-20 10:23:00,260:INFO:Stopped SystemPerformanceManager. 2020-07-20 10:23:00,260:INFO:CDA stopped with exit code 0.

Ran 1 test in 0.115s

OK

dbeavers commented 1 year ago

add from programmingtheiot.cda.system.SystemPerformanceManager import SystemPerformanceManager

labbenchstudios commented 1 year ago

Fixed - added requisite import statement.