Skip to content

Instantly share code, notes, and snippets.

View trarbr's full-sized avatar

Troels Brødsgaard trarbr

  • Svendborg, Denmark
View GitHub Profile
@trarbr
trarbr / ble-debugging-guide.md
Last active June 30, 2022 03:33
Debugging Bluetooth with HCI packet logs

Are you using Blue Heron on your Nerves device? Are you having trouble figuring out why things aren't working? Fear not! The HCI packet log may be able to help you. And this gist will let you know how to read it with Wireshark.

The Blue Heron readme states:

This project includes a Logger backend to dump PKTLOG format. This is the same format that Android, IOS, btstack, hcidump, and bluez use.

By default, Blue Heron will write this PKGLOG to /tmp/hcidump.pklg on your Nerves device. You can transfer it to your computer with scp (scp nerves.local:/tmp/hcidump.pklg . should copy it to your local directory).

@trarbr
trarbr / peripheral.livemd
Created September 14, 2021 07:36
A BLE Peripheral Livebook example (using Livebook on Nerves and Blue Heron)

Peripheral

Library code

First we define the Characteristic and Service modules. Users of the library use these to declare the services that their device expose.

defmodule BlueHeron.GATT.Characteristic do
  defstruct [:id, :type, :properties, :permissions, :descriptors, :handle, :value_handle]