Puck as remote mute button for Zoom on iOS

Posted on
  • Hi there,

    I bought a puck the other day to learn about JS, and thought my first project would be to try and make a remote mute button to use with Zoom conferencing on my ipad, I found that Zoom lets you use a keyboard shortcut "command + shift + A" so as it's an apple device it requires the command key which is equal to the Windows button on a PC.

    In the module ble_hid_keyboard.js i can see no reference to the Windows key so was wondering how I would go about coding this, assume the module would need to support this?

    Appreciate any ideas

    Many Thanks
    Neil

  • Thanks Robin appreciate the links I'll take a look at these, this evening I have updated the module "ble_hid­_keyboard.js" locally to add the keys i need but my Web IDE on Mac doesn't seem to have projects under settings for me to load local modules!

    Thanks again for your help

  • Is it possible that what you need is just kb.MODIFY.GUI?

    But if you want to mess with modules yourself, the easiest method is just to add it to your existing code:

    Modules.addCached("ble_hid_keyboard",function() {
    // module contents
    });
    
    var kb = require("ble_hid_keyboard");
    NRF.setServices(undefined, { hid : kb.report });
    // ...
    
  • Thank you Gordon for your response,

    Apologies JS is relatively new to me, but your tip on just using MODIFY was just what was needed, once i figured out how to concatenate the keys it worked liked a charm for me.

    I have one remaining issue in that my iPad now warns me in bluetooth settings, when the Puck is connected to it, I'm guess its not a recognised bluetooth vendor ID or something?

    Error on iPad
    Using puck.js may affect Wi-Fi and Bluetooth connectivity.

    Very pleased with the Puck.js have many more ideas for it!

    Many thanks
    Neil

  • Using puck.js may affect Wi-Fi and Bluetooth connectivity.

    Wow, that's new! Do you have a screenshot?

    I have a feeling that may be Apple's way of saying: "this device manufacturer hasn't paid us to be iOS certified"

  • Hi Gordon,

    I've attached the screen shot from my iPad plus my code in case anything might be causing it in there! I have tried playing with the NRF.setServices values to see if it makes any difference but still the same result.

    NRF.setAdvertising({}, {name: "Zoom Remote"});
    var kb = require("ble_hid_keyboard");
    
    // NRF.setServices(undefined, { hid : kb.report });
    
    var services = {
      0x180a: {
        0x2a50: {
          value:     [
            0x01,           /* Use USB Vendor IDs */
            0xac, 0x05,     /* Apple */
            0x5a, 0x02,     /* Internal Keyboard */
            0x00, 0x00
          ],
          readable:  true,
        }
      }
    };
    
    NRF.setServices(services, {
      advertise: [ 0x180a ],
      hid: kb.report
    });
    
    function btnPressed() {
      // Send 'Command + Shift + A'
        kb.tap(kb.KEY.A, kb.MODIFY.LEFT_GUI | kb.MODIFY.SHIFT);
        // Now toggle LED status
        swap();
    }
    
    // keep track of the LED status on button pushes
    var LED_toggle = 1;
    
    function swap() {
      // determine to turn RED LED on/off
      switch(LED_toggle) {
        case 1:
          LED1.write(1);
          break;
        case 2:
          LED1.write(0);
          break;
      }
      // determine the LED status on/off
      LED_toggle = Math.wrap(LED_toggle, 2) + 1;
    }
    
    // trigger btnPressed whenever the button is pressed
    setWatch(btnPressed, BTN, {edge:"rising",repeat:true,debounce:50});
    

    Many Thanks
    Neil


    1 Attachment

    • Screenshot 2020-03-31 at 23.01.52.jpg
  • Thanks! What you're doing sounds perfectly fine. I guess you tried without the magic Apple service?

    Only thing I can think is maybe it's complaining about the connection interval? Espruino uses a fast connection interval normally and drops down after 1-2 minutes of inactivity.

    You could force it to use a lower connection interval with something like NRF.setConnectionInterval(100).

  • Hi Neil - Thanks for the cool idea. I was killing time browsing the forum because I was in a Webex meeting waiting for a late attendee. In just the few minutes waiting for him to show up, I was able to find my Puck, modify your code to work for Webex, upload it, & now I have a working mute button too!

    For anyone else who wants to use it with Webex - the Webex keyboard shortcut is CMD + SHIFT + M, so just change kb.KEY.A in the code above to kb.KEY.M. Works like a charm.

    FWIW, I'm using it on a Macbook and I don't get any Bluetooth warning like the iOS one noted above.

    -Dan

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Puck as remote mute button for Zoom on iOS

Posted by Avatar for Neil_ @Neil_

Actions