Review and clean-up memory use in general (make sure .ts stuff doesn't eat more mem than needed)
Go to more standard debug stuff (DMESG) if it works...
Should each service be a separate module/extension?
Review / suggestions for semantics and affordances.
Mouse and Gamepad semantics are clunky. Maybe a smaller "dpad only" block for Gamepad and mouse x,y,button, hold for mouse?
Better use of types to enforce correct use.
Get rid of setStatusChangeHandler and isEnabled() in each service. They were useful for development, but don't provide much benefit beyond Bluetooth connection blocks now. (This would also remove the Event ID concerns).
Consider changing AbsMouse coordinates to be screen coordinates. (Upper left is (0,0))
V1
Ball is in someone else's court. This will require a pretty serious overhaul. See #7.
CODAL Changes
HIDService needs memory for the characteristic that allow the report map to expand. The total size needs to be known before the service is created, which doesn't work well with the block semantics. Consequently a static buffer is created (reportMap) using the constreportMapMaxSize. Select a reasonable default value and have a pxt.json flag for larger values? (See #13)
Advertising
Set a service UUID in the ad.
Set the appearance
Set the Pairing mode in the ad.
Descriptors: Reports require special descriptors. It'd be nice if CODAL included support to add these as part of a characteristic.
Event / Message ID stuff (too ad-hoc as-is) (the ID numbers in each Reporter are just made up / sequential.
I've added a gross hack to monitor pm_events and restore CCCDs (which is already being done by the peer_manager, but not propagated to the MicroBitBLEChar's internal cccd field. This should be done as part of the peer_manager mechanics in MicroBitBLEManager instead. (See #15)
The MicroBitBLEChar's cccNotify and cccIndicate should be updated to use the CCCD value from the stack IF the characteristic has a CCCD. (Use sd_ble_gatts_value_get to get the value for the handle to the CCCD). Something like this for notify:
if(handles.cccd == 0 || conn_handle==BAD)
return false;
uint16_t value;
ble_gatts_value_t data;
memset(&data, 0, sizeof(ble_gatts_value_t));
data.len = 2;
data.p_value = &value;
sd_ble_gatts_value_get(conn_handle, handles.cccd, &data);
// Should this notify services of the update? I think so... Use the onWrite method since it was a write to the value
return data& BLE_GATT_HVX_NOTIFICATION;
* If moved, then the `pm_events` and `static_pm_events` fields in HIDService.cpp can be removed.
* See https://github.com/lancaster-university/codal-microbit-v2/issues/160
Notes
Misc. Finishing stuff.
setStatusChangeHandler
andisEnabled()
in each service. They were useful for development, but don't provide much benefit beyond Bluetooth connection blocks now. (This would also remove the Event ID concerns).AbsMouse
coordinates to be screen coordinates. (Upper left is (0,0))V1
Ball is in someone else's court. This will require a pretty serious overhaul. See #7.
CODAL Changes
reportMap
) using theconst
reportMapMaxSize
. Select a reasonable default value and have apxt.json
flag for larger values? (See #13)I've added a gross hack to monitor pm_events and restore CCCDs (which is already being done by the peer_manager, but not propagated to the MicroBitBLEChar's internal cccd field. This should be done as part of the peer_manager mechanics in MicroBitBLEManager instead. (See #15)
MicroBitBLEChar
'scccNotify
andcccIndicate
should be updated to use the CCCD value from the stack IF the characteristic has a CCCD. (Usesd_ble_gatts_value_get
to get the value for the handle to the CCCD). Something like this for notify: