Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MakeCode Integration #14

Open
bsiever opened this issue Dec 29, 2021 · 0 comments
Open

MakeCode Integration #14

bsiever opened this issue Dec 29, 2021 · 0 comments

Comments

@bsiever
Copy link
Owner

bsiever commented Dec 29, 2021

Notes

  • Only supports input descriptors now

Misc. Finishing stuff.

  • Testing
  • Translations: Do to I support these everywhere?
  • 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 const reportMapMaxSize. Select a reasonable default value and have a pxt.json flag for larger values? (See Memory allocation #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 Notification Persistance #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;
    
    
This was referenced Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant