Skip to content

Commit 50f2a7e

Browse files
Merge pull request #1004 from LedgerHQ/spo-fix-flex-ble-uuid
[lib_ble]: Add Flex UUID's, keep LNX UUID's as default
2 parents 8a00258 + de887c7 commit 50f2a7e

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

lib_blewbxx/src/ble_ledger_profile_apdu.c

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,24 @@ static ledger_ble_profile_apdu_handle_t ledger_apdu_profile_handle;
9797
static uint8_t ble_ledger_protocol_chunk_buffer[BLE_ATT_MAX_MTU_SIZE];
9898

9999
// clang-format off
100+
#ifdef TARGET_FLEX
101+
const uint8_t charUuidTX[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x01,0x00,0x04,0x30,0x97,0x2c,0x00,0x34,0xd6,0x13};
102+
const uint8_t charUuidRX[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x02,0x00,0x04,0x30,0x97,0x2c,0x00,0x34,0xd6,0x13};
103+
const uint8_t charUuidRX2[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x03,0x00,0x04,0x30,0x97,0x2c,0x00,0x34,0xd6,0x13};
104+
#else // !TARGET_FLEX
105+
100106
#ifdef TARGET_STAX
101-
const uint8_t charUuidTX[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x01,0x00,0x04,0x60,0x97,0x2C,0x00,0x34,0xD6,0x13};
102-
const uint8_t charUuidRX[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x02,0x00,0x04,0x60,0x97,0x2C,0x00,0x34,0xD6,0x13};
103-
const uint8_t charUuidRX2[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x03,0x00,0x04,0x60,0x97,0x2C,0x00,0x34,0xD6,0x13};
104-
#else // ! TARGET_STAX
105-
const uint8_t charUuidTX[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x01,0x00,0x04,0x00,0x97,0x2C,0x00,0x34,0xD6,0x13};
106-
const uint8_t charUuidRX[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x02,0x00,0x04,0x00,0x97,0x2C,0x00,0x34,0xD6,0x13};
107-
const uint8_t charUuidRX2[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x03,0x00,0x04,0x00,0x97,0x2C,0x00,0x34,0xD6,0x13};
107+
const uint8_t charUuidTX[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x01,0x00,0x04,0x60,0x97,0x2c,0x00,0x34,0xd6,0x13};
108+
const uint8_t charUuidRX[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x02,0x00,0x04,0x60,0x97,0x2c,0x00,0x34,0xd6,0x13};
109+
const uint8_t charUuidRX2[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x03,0x00,0x04,0x60,0x97,0x2c,0x00,0x34,0xd6,0x13};
110+
#else // !TARGET_FLEX && !TARGET_STAX
111+
112+
const uint8_t charUuidTX[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x01,0x00,0x04,0x00,0x97,0x2c,0x00,0x34,0xd6,0x13};
113+
const uint8_t charUuidRX[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x02,0x00,0x04,0x00,0x97,0x2c,0x00,0x34,0xd6,0x13};
114+
const uint8_t charUuidRX2[BLE_UUID_SIZE] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x03,0x00,0x04,0x00,0x97,0x2c,0x00,0x34,0xd6,0x13};
115+
108116
#endif // ! TARGET_STAX
117+
#endif // ! TARGET_FLEX
109118
// clang-format on
110119
static uint8_t BLE_LEDGER_apdu_buffer[OS_IO_BUFFER_SIZE + 1];
111120

@@ -116,11 +125,17 @@ const ble_profile_info_t BLE_LEDGER_PROFILE_apdu_info = {
116125
.service_uuid
117126
= {.type = BLE_GATT_UUID_TYPE_128,
118127
// clang-format off
128+
#ifdef TARGET_FLEX
129+
.value = {0x72,0x65,0x67,0x64,0x65,0x4c,0x00,0x00,0x04,0x30,0x97,0x2c,0x00,0x34,0xd6,0x13}},
130+
#else // !TARGET_FLEX
131+
119132
#ifdef TARGET_STAX
120-
.value = {0x72,0x65,0x67,0x64,0x65,0x4c,0x00,0x00,0x04,0x60,0x97,0x2C,0x00,0x34,0xD6,0x13}},
121-
#else // ! TARGET_STAX
122-
.value = {0x72,0x65,0x67,0x64,0x65,0x4c,0x00,0x00,0x04,0x00,0x97,0x2C,0x00,0x34,0xD6,0x13}},
133+
.value = {0x72,0x65,0x67,0x64,0x65,0x4c,0x00,0x00,0x04,0x60,0x97,0x2c,0x00,0x34,0xd6,0x13}},
134+
#else // !TARGET_FLEX && !TARGET_STAX
135+
136+
.value = {0x72,0x65,0x67,0x64,0x65,0x4c,0x00,0x00,0x04,0x00,0x97,0x2c,0x00,0x34,0xd6,0x13}},
123137
#endif // ! TARGET_STAX
138+
#endif // ! TARGET_FLEX
124139
// clang-format on
125140

126141
.init = BLE_LEDGER_PROFILE_apdu_init,
@@ -631,7 +646,7 @@ ble_profile_status_t BLE_LEDGER_PROFILE_apdu_send_packet(const uint8_t *packet,
631646
bool BLE_LEDGER_PROFILE_apdu_is_busy(void *cookie)
632647
{
633648
ledger_ble_profile_apdu_handle_t *handle = (ledger_ble_profile_apdu_handle_t *) PIC(cookie);
634-
bool busy = false;
649+
bool busy = false;
635650

636651
if (handle->state == LEDGER_BLE_PROFILE_APDU_BUSY) {
637652
busy = true;

0 commit comments

Comments
 (0)