Skip to content

Add MFi #708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: release_candidate
Choose a base branch
from
Open

Add MFi #708

wants to merge 16 commits into from

Conversation

PaulZC
Copy link
Contributor

@PaulZC PaulZC commented Aug 1, 2025

No description provided.

@PaulZC PaulZC requested a review from nseidle August 1, 2025 09:15
@nseidle
Copy link
Member

nseidle commented Aug 1, 2025

Excellent work! It's not compiling for me yet:

undefined reference to `esp_sdp_init'
undefined reference to `esp_sdp_create_record'

Also, the additional BT radio state BLUETOOTH_RADIO_SPP_ACCESSORY_MODE is not needed and requires the user to proactively configure the RTK device to work with an iPhone. IMO, this is bad. I don't think it's needed and could be removed. This is how:

  • Expose an appleAccessory->isIap2Online() bool to the Apple Accessory lib. This returns true if the connection has successfully setup the IAP2 layer. Perhaps at the IAP2_CTL_MSG_AUTH_SUCCEEDED event.
  • Add an online.iap2 in settings.h
  • In updateAuthCoPro(), once isIal2Online, online.Iap2 = true.
  • Use online.iap2 in Bluetooth.ino to direct traffic

What do you think?

@PaulZC
Copy link
Contributor Author

PaulZC commented Aug 1, 2025

Are the compiler errors caused by libbt.a? Have you updated libbt.a with the copy from the Patch folder? The workflow will do the same thing here. Also, please check you're on v3.0.7.

I think BLUETOOTH_RADIO_SPP_ACCESSORY_MODE probably is necessary; it requires isMaster to be true (Link). Whereas BLUETOOTH_RADIO_SPP requires false (Link). But I'll take another look...

@PaulZC
Copy link
Contributor Author

PaulZC commented Aug 1, 2025

@nseidle : I think you might be asking for the impossible... With isMaster set false I see:

[ 48124][I][BluetoothSerial.cpp:613] esp_bt_gap_cb(): ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT ACL connection from: 84:ab:1a:ac:f1:cb
Apple Device 84:ab:1a:ac:f1:cb found, connecting on channel 1
[ 48139][E][BluetoothSerial.cpp:1175] isReady(): Master mode is not active. Call begin(localName, true) to enable Master mode
[ 49514][I][BluetoothSerial.cpp:623] esp_bt_gap_cb(): ESP_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT ACL disconnection complete status event: reason 275, handle 128

I'm open to suggestions, but currently I think we do need BLUETOOTH_RADIO_SPP_ACCESSORY_MODE?

@nseidle
Copy link
Member

nseidle commented Aug 4, 2025

Compiling again! Thanks for the reminder. I forgot to patch my Arduino-CLI.

I think the trick is to start Bluetooth in Slave mode + SDP advertising of UUID. If an ACL event is detected, then switch to Bluetooth Master mode and initiate connection. I'll create a branch that demos this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants