Giter VIP home page Giter VIP logo

microbit-pxt-blehid's People

Contributors

bsiever avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

microbit-pxt-blehid's Issues

It does not work

When I connect the micro:bit to the computer, it recognizes it as a mouse and keyboard but I made the code click and i does not click the mouse.

Test / Revise Gamepad

Memory allocation

Two options:

  • A pxt.json setting
  • Dynamic memory (IFF Nordic stack can update to use new locations for VLOC user and variable length)

Branches

Clean up branch mess (merge master into main / delete master; Merge in "Single Service" branch)

V1 support

V1 build environment lacks the MicroBitBLEService class used as the base for HIDService.

Creating an alternative with the minimum features for HIDService may be sufficient (CreateService, CreateCharacteristic and utilize the BLE callbacks for on...() events).

Spacebar

How can you use spacebar? I had a look through the docs but I can't seem to find it.

Reduce Memory (RAM)

Reduce memory: Replace static memory for report with table-based approach.

struct reporterEntry {
   uint8_t *data;
   uint16_t reportIDOffset;
   uint16_t length;
   reportEntry *next;
}

static reportEntry *reports;

Or maybe static array instead of linked list of nodes?

MakeCode Integration

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 #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;
    
    

Update Docs

Update documentation to describe the device name block and how it's related to the advertised name.

Docs

Need documentation:

  • Use MakeCode README for block data.
  • Maybe GitHub repo's wiki for devices that work/don't?
  • Videos of use (how to pair / unpair)
    • Videos of cool applications

Testing!

Need to do lots of testing. Some issues:

  • Long-term runs
  • Check AbsoluteMouse behavior
  • Behavior on different platforms
  • Combinations of services

Notification Persistance

macOS / iOS appear to "renew" notifications on connect, but Android and Windows don't. The peer manager should save/restore them, but it doesn't look like it's working.

Decouple advertising

Move advertising to another module and make a dependency.
(And other services, like mouse, as separate modules...that can be composed)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.