Open labbenchstudios opened 3 years ago
Dear Professor Andy,
I discovered an issue in the premade CoapServerAdapterTest given to us as part of the initial codebase.
Line 204 in coapServerAdapterTest is sysPerfData.setMemoryUtilization(sysPerfData) This is causing a recursion issue (can be seen when line 207 is uncommented) when the to_string method is called because the object is directly passed to the method as the memory utilization rather than an actual value.
I think it might be a typo and that the intent was for the code to be this: sysPerfData.setMemoryUtilization(sysPerfVal)
Request you to recheck and update the test case.
Thanks, Gautam
Good catch. This is now fixed / pushed to the GitHub repo.
Description
CoapServerAdapter
to support the addition of either internally created resource handler instances, or externally created resource handlers that are passed into the server from - for example -DeviceDataManager
.Review the README
Estimated effort may vary greatly
IMPORTANT NOTE
Actions - for
CoapServerAdapter
addResource()
method as well as the_initServer()
method to create and register the resource handlers you created earlier.self._initServer()
method after initializing the CoAP server instance and storing the class-scoped dataMsgListener reference.self._initServer()
method. This will instance all requisite resource handlers, set appropriate callbacks (so the handlers will either (a) be notified when new data is available or (b) have access toIDataMessageListener
to send updates). Here are some notional examples - remember that your implementation will likely vary from the following, and will depend on the library you choose to use:Using aiocoap (NOTE: only tested on Ubuntu 21.10)
Using CoAPthon3
addResource(ResourceNameEnum resourceType, Resource resource)
method, which will allow you to add resource handlers from external class instances (such asDeviceDataManager
).Using aiocoap
Using CoAPthon3
Estimate (Small = < 2 hrs; Medium = 4 hrs; Large = 8 hrs)
Tests
programmingtheiot/part03/integration/connection
namedCoapServerAdapterTest
.CoapClientToServerConnectorTest
, although it's easiest to simply create a single test method that contains the server creation, start, and stop calls.