Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
François Revol
firmware
Commits
1ea9b516
Commit
1ea9b516
authored
Sep 06, 2020
by
schneider
Browse files
fix(ble): Raise NotImplementedError when trying to use (u)bluetooth module
parent
e8528908
Changes
1
Hide whitespace changes
Inline
Side-by-side
pycardium/modules/modbluetooth_card10.c
View file @
1ea9b516
#include
"extmod/modbluetooth.h"
#include
"py/runtime.h"
#include
<stdint.h>
const
char
*
const
not_implemented_message
=
"Not (yet) implemented on card10. See https://git.card10.badge.events.ccc.de/card10/firmware/-/issues/8"
;
static
void
raise
(
void
)
{
mp_raise_NotImplementedError
(
not_implemented_message
);
}
// Enables the Bluetooth stack.
int
mp_bluetooth_init
(
void
)
{
raise
();
return
0
;
}
// Disables the Bluetooth stack. Is a no-op when not enabled.
void
mp_bluetooth_deinit
(
void
)
{
raise
();
}
// Returns true when the Bluetooth stack is enabled.
bool
mp_bluetooth_is_enabled
(
void
)
{
raise
();
return
false
;
}
...
...
@@ -33,17 +45,20 @@ int mp_bluetooth_gap_advertise_start(
const
uint8_t
*
sr_data
,
size_t
sr_data_len
)
{
raise
();
return
0
;
}
// Stop advertisement. No-op when already stopped.
void
mp_bluetooth_gap_advertise_stop
(
void
)
{
raise
();
}
// Start adding services. Must be called before mp_bluetooth_register_service.
int
mp_bluetooth_gatts_register_service_begin
(
bool
append
)
{
raise
();
return
0
;
}
// // Add a service with the given list of characteristics to the queue to be registered.
...
...
@@ -58,11 +73,13 @@ int mp_bluetooth_gatts_register_service(
uint16_t
*
handles
,
size_t
num_characteristics
)
{
raise
();
return
0
;
}
// Register any queued services.
int
mp_bluetooth_gatts_register_service_end
()
{
raise
();
return
0
;
}
...
...
@@ -70,17 +87,20 @@ int mp_bluetooth_gatts_register_service_end()
int
mp_bluetooth_gatts_read
(
uint16_t
value_handle
,
uint8_t
**
value
,
size_t
*
value_len
)
{
raise
();
return
0
;
}
// Write a value to the local gatts db (ready to be queried by a central).
int
mp_bluetooth_gatts_write
(
uint16_t
value_handle
,
const
uint8_t
*
value
,
size_t
value_len
)
{
raise
();
return
0
;
}
// Notify the central that it should do a read.
int
mp_bluetooth_gatts_notify
(
uint16_t
conn_handle
,
uint16_t
value_handle
)
{
raise
();
return
0
;
}
// Notify the central, including a data payload. (Note: does not set the gatts db value).
...
...
@@ -90,11 +110,13 @@ int mp_bluetooth_gatts_notify_send(
const
uint8_t
*
value
,
size_t
*
value_len
)
{
raise
();
return
0
;
}
// Indicate the central.
int
mp_bluetooth_gatts_indicate
(
uint16_t
conn_handle
,
uint16_t
value_handle
)
{
raise
();
return
0
;
}
...
...
@@ -102,12 +124,14 @@ int mp_bluetooth_gatts_indicate(uint16_t conn_handle, uint16_t value_handle)
// Append-mode means that remote writes will append and local reads will clear after reading.
int
mp_bluetooth_gatts_set_buffer
(
uint16_t
value_handle
,
size_t
len
,
bool
append
)
{
raise
();
return
0
;
}
// Disconnect from a central or peripheral.
int
mp_bluetooth_gap_disconnect
(
uint16_t
conn_handle
)
{
raise
();
return
0
;
}
...
...
@@ -116,12 +140,14 @@ int mp_bluetooth_gap_disconnect(uint16_t conn_handle)
int
mp_bluetooth_gap_scan_start
(
int32_t
duration_ms
,
int32_t
interval_us
,
int32_t
window_us
)
{
raise
();
return
0
;
}
// Stop discovery (if currently active).
int
mp_bluetooth_gap_scan_stop
(
void
)
{
raise
();
return
0
;
}
...
...
@@ -129,12 +155,14 @@ int mp_bluetooth_gap_scan_stop(void)
int
mp_bluetooth_gap_peripheral_connect
(
uint8_t
addr_type
,
const
uint8_t
*
addr
,
int32_t
duration_ms
)
{
raise
();
return
0
;
}
// Find all primary services on the connected peripheral.
int
mp_bluetooth_gattc_discover_primary_services
(
uint16_t
conn_handle
)
{
raise
();
return
0
;
}
...
...
@@ -142,6 +170,7 @@ int mp_bluetooth_gattc_discover_primary_services(uint16_t conn_handle)
int
mp_bluetooth_gattc_discover_characteristics
(
uint16_t
conn_handle
,
uint16_t
start_handle
,
uint16_t
end_handle
)
{
raise
();
return
0
;
}
...
...
@@ -149,12 +178,14 @@ int mp_bluetooth_gattc_discover_characteristics(
int
mp_bluetooth_gattc_discover_descriptors
(
uint16_t
conn_handle
,
uint16_t
start_handle
,
uint16_t
end_handle
)
{
raise
();
return
0
;
}
// Initiate read of a value from the remote peripheral.
int
mp_bluetooth_gattc_read
(
uint16_t
conn_handle
,
uint16_t
value_handle
)
{
raise
();
return
0
;
}
...
...
@@ -166,6 +197,7 @@ int mp_bluetooth_gattc_write(
size_t
*
value_len
,
unsigned
int
mode
)
{
raise
();
return
0
;
}
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment