Testing GB

Posted on
  • Hi,

    I'm working on an app to parse some of the notifications that gadgetbridge delivers to the watch (I want to store them to a file, for things like weather/football fixtures/etc)

    Is there an easy way to test this? I write some code in my app on my laptop, connect to the watch to laptop, upload the app, disconnect the laptop, connect my phone, trigger the notification, try and debug....

    Is there a way of triggering the GB event via the laptop, to avoid all the disconnecting and reconnecting?

    Thanks,

    Mat

  • Hi Mat,

    sure, connect the WebIDE, then in the REPL (left side) just type something like

    GB({"t":"notify","src":"test","body":"te­st"});
    

    That will trigger the GB function from GadgetBridge.

  • I did some research for you to try help your setup. This should get you what you want, ie. viewing output bluetooth packets from phone to watch. Requires installing wireshark on laptop.
    The other way to do this would be to use https://www.espruino.com/Reference#t_l_S­erial_pipe on your watch. "Bluetooth" is a Stream class so Bluetooth.pipe. Then all data will go into a file for you to inspect.

    On the applicable Android devices, it is possible to capture Bluetooth traffic as follows:
    Go to Settings
    If developer options is not enabled, enable it now.
    Go into developer options
    Enable the option Enable Bluetooth HCI snoop log
    Perform the actions which need to be captured.
    Disable the option Enable Bluetooth HCI snoop log
    As the relevant files might not been shown in a PC's file browser in 'Internal Storage', copy the file to a PC by means of the Android Debug Bridge: adb pull /sdcard
    The files of interest are btsnoop_hci.log and all files with the extension .cfa
    These are binary files, which can be opened with Wireshark.

  • There is a 3rd method that is probably the most easiest, enable debug log in the gadgetbridge settings on your phone. You will find the file in

    /sdcard/Android/data/nodomain.freeyourga­dget.gadgetbridge/files/gadgetbridge.log­.

    If you are interested in notification commands eg. search for

    GB({"t":"notify"

  • Thanks guys, really helpful!

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

Testing GB

Posted by Avatar for user115240 @user115240

Actions