Developing an iPhone App leveraging the Bluetooth API

Hi everyone, I’ve been tinkering for a few weeks now and have not been able to get the Bluetooth API to successfully send a Protobuf packet.

The current situation is that for protobufs that are successfully sent to the meshtastic device (Heltec ESP32 LoRa V3), they don’t end up making it onto my mesh channels. The V3 unit just thinks it sent the message, but other nodes do not receive anything. When connecting via the Meshtastic app and using the chat functionality, this node works fine, so it seems to be something wrong with the Bluetooth API or my Protobufs.

Any help would be deeply appreciated!

Logs from meshtastic device when it thinks it is sending a message:

INFO | ??:??:?? 2789 To Radio onwrite

DEBUG | ??:??:?? 2789 PACKET FROM PHONE (id=0xc7c19d5e fr=0x00 to=0x00, WantAck=0, HopLim=0 Ch=0x1 Portnum=256)

DEBUG | ??:??:?? 2789 Add packet record (id=0xc7c19d5e fr=0x00 to=0x00, WantAck=0, HopLim=0 Ch=0x1 Portnum=256)

DEBUG | ??:??:?? 2789 Unset PSK for secondary channel Public. using primary key

DEBUG | ??:??:?? 2789 Using AES128 key!

DEBUG | ??:??:?? 2789 ESP32 crypt fr=433f1fa0, num=c7c19d5e, numBytes=7!

DEBUG | ??:??:?? 2789 enqueuing for send (id=0xc7c19d5e fr=0xa0 to=0x00, WantAck=0, HopLim=0 Ch=0x88 encrypted)

DEBUG | ??:??:?? 2789 txGood=9,rxGood=5,rxBad=0

INFO | ??:??:?? 2789 Telling client we have new packets 58

INFO | ??:??:?? 2789 BLE notify fromNum

DEBUG | ??:??:?? 2789 [RadioIf] Starting low level send (id=0xc7c19d5e fr=0xa0 to=0x00, WantAck=0, HopLim=0 Ch=0x88 encrypted priority=64)

DEBUG | ??:??:?? 2789 [RadioIf] (bw=250, sf=11, cr=4/5) packet symLen=8 ms, payloadSize=23, time 403 ms

DEBUG | ??:??:?? 2789 [RadioIf] AirTime - Packet transmitted : 403ms

INFO | ??:??:?? 2789 getFromRadio=STATE_SEND_PACKETS

DEBUG | ??:??:?? 2790 [RadioIf] Completed sending (id=0xc7c19d5e fr=0xa0 to=0x00, WantAck=0, HopLim=0 Ch=0x88 encrypted priority=64)

react-native object being used as input to be encoded as a protobuf:

const toRadioPayload = {
packet: {
channel: 1, // have tried with and without this, channel 1 is encrypted
decoded: {
portnum: 256, // have tried 1 as well.
payload: Buffer.from(“Hello”, ‘utf-8’)
},
//set the id as a uint32
id: Math.floor(Math.random() * 10000000000),
}
}

To see it in a channel, you have to send it as a broadcast message, which means to: 4294967295, or 0xFFFFFFFF in hexadecimal.

Also, the port number for a text message is 1.

Thank you, is there documentation that details this?

I understand the port Number, it’s in a proto file, but the broadcasting is news to me…

Also, very weird phenomena, when my message is longer than 2-3 letters, the device no longer likes my protobuf

logs:
also, any idea why i would get this response from a meshpacket once my message is more than 2-3 letters?

INFO | ??:??:?? 280 To Radio onwrite

ERROR | ??:??:?? 280 Can’t decode protobuf reason=‘parent stream too short’, pb_msgdesc 0x3c15da60

ERROR | ??:??:?? 280 Error: ignoring malformed toradio

INFO | ??:??:?? 280 To Radio onwrite

ERROR | ??:??:?? 280 Can’t decode protobuf reason=‘invalid wire_type’, pb_msgdesc 0x3c15da60

ERROR | ??:??:?? 280 Error: ignoring malformed toradio

any thoughts on why it would be too short or have an invalid wire type if my message gets longer, OR If I add parameters to my protobuff

Some of the documentation is here, but I don’t think there is a definite guide to developing an app. You could look at the existing ones, for example.

You might need to set the payload size of the packet, I’m unsure how this works in React Native.