At the moment, I'm working on phase 1 of the issue which adds some type-safety to the driver's API. Drivers need to report values and receive values (for settable devices.) This requires changes in 3 types:
The ReportReading closure now takes a type parameter. When registering a device, its type is also declared. No longer can one accidentally save a String for a bool device.
When registering, the previous value (if any) of the device is returned. This value needs to be converted to the device's type (instead of just being a device::Value.
Incoming settings need to convert device::Value types to the device's declared type. If it can't, the API should automatically send a TypeError back to the client.
At this point, I've pushed commits which support the first two requirements. I'm still working on the third.
At the moment, I'm working on phase 1 of the issue which adds some type-safety to the driver's API. Drivers need to report values and receive values (for settable devices.) This requires changes in 3 types:
ReportReading
closure now takes a type parameter. When registering a device, its type is also declared. No longer can one accidentally save aString
for abool
device.device::Value
.device::Value
types to the device's declared type. If it can't, the API should automatically send aTypeError
back to the client.At this point, I've pushed commits which support the first two requirements. I'm still working on the third.
This pull request will close out #13.