Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
43bca5af
Commit
43bca5af
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
feat(mp-ble): Allow to close current connection
parent
92227700
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
epicardium/ble/epic_ble_api.c
+11
-0
11 additions, 0 deletions
epicardium/ble/epic_ble_api.c
epicardium/epicardium.h
+4
-1
4 additions, 1 deletion
epicardium/epicardium.h
pycardium/modules/modbluetooth_card10.c
+6
-4
6 additions, 4 deletions
pycardium/modules/modbluetooth_card10.c
with
21 additions
and
5 deletions
epicardium/ble/epic_ble_api.c
+
11
−
0
View file @
43bca5af
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include
"api/interrupt-sender.h"
#include
"api/interrupt-sender.h"
#include
"wsf_buf.h"
#include
"wsf_buf.h"
#include
"app_api.h"
#include
"svc_core.h"
#include
"svc_core.h"
#include
"FreeRTOS.h"
#include
"FreeRTOS.h"
...
@@ -92,6 +93,16 @@ void ble_epic_dm_api_event(dmEvt_t *dm_event)
...
@@ -92,6 +93,16 @@ void ble_epic_dm_api_event(dmEvt_t *dm_event)
}
}
}
}
void
epic_ble_close_connection
(
uint8_t
connId
)
{
AppConnClose
(
connId
);
}
int
epic_ble_is_connection_open
(
void
)
{
return
AppConnIsOpen
();
}
int
epic_ble_set_device_name
(
const
uint8_t
*
buf
,
uint16_t
len
)
int
epic_ble_set_device_name
(
const
uint8_t
*
buf
,
uint16_t
len
)
{
{
return
epic_ble_atts_set_attr
(
GAP_DN_HDL
,
buf
,
len
);
return
epic_ble_atts_set_attr
(
GAP_DN_HDL
,
buf
,
len
);
...
...
This diff is collapsed.
Click to expand it.
epicardium/epicardium.h
+
4
−
1
View file @
43bca5af
...
@@ -177,6 +177,8 @@ typedef _Bool bool;
...
@@ -177,6 +177,8 @@ typedef _Bool bool;
#define API_BLE_GET_ATT_WRITE 0x1BD
#define API_BLE_GET_ATT_WRITE 0x1BD
#define API_BLE_FREE_ATT_WRITE 0x1BE
#define API_BLE_FREE_ATT_WRITE 0x1BE
#define API_BLE_ATTS_DYN_ADD_CHARACTERISTIC 0x1BF
#define API_BLE_ATTS_DYN_ADD_CHARACTERISTIC 0x1BF
#define API_BLE_CLOSE_CONNECTION 0x170
#define API_BLE_IS_CONNECTION_OPEN 0x171
#define API_BLE_SET_DEVICE_NAME 0x172
#define API_BLE_SET_DEVICE_NAME 0x172
#define API_BLE_GET_DEVICE_NAME 0x173
#define API_BLE_GET_DEVICE_NAME 0x173
#define API_BLE_GET_ADDRESS 0x174
#define API_BLE_GET_ADDRESS 0x174
...
@@ -2607,7 +2609,8 @@ API(API_BLE_ATTS_HANDLE_VALUE_IND, int epic_ble_atts_handle_value_ind(uint8_t co
...
@@ -2607,7 +2609,8 @@ API(API_BLE_ATTS_HANDLE_VALUE_IND, int epic_ble_atts_handle_value_ind(uint8_t co
API
(
API_BLE_ATTS_SET_BUFFER
,
int
epic_ble_atts_set_buffer
(
uint16_t
value_handle
,
size_t
len
,
bool
append
));
API
(
API_BLE_ATTS_SET_BUFFER
,
int
epic_ble_atts_set_buffer
(
uint16_t
value_handle
,
size_t
len
,
bool
append
));
API
(
API_BLE_FREE_EVENT
,
int
epic_ble_free_event
(
struct
epic_ble_event
*
e
));
API
(
API_BLE_FREE_EVENT
,
int
epic_ble_free_event
(
struct
epic_ble_event
*
e
));
API
(
API_BLE_CLOSE_CONNECTION
,
void
epic_ble_close_connection
(
uint8_t
connId
));
API
(
API_BLE_IS_CONNECTION_OPEN
,
int
epic_ble_is_connection_open
(
void
));
API
(
API_BLE_SET_DEVICE_NAME
,
int
epic_ble_set_device_name
(
const
uint8_t
*
buf
,
uint16_t
len
));
API
(
API_BLE_SET_DEVICE_NAME
,
int
epic_ble_set_device_name
(
const
uint8_t
*
buf
,
uint16_t
len
));
API
(
API_BLE_GET_DEVICE_NAME
,
int
epic_ble_get_device_name
(
uint8_t
**
buf
,
uint16_t
*
len
));
API
(
API_BLE_GET_DEVICE_NAME
,
int
epic_ble_get_device_name
(
uint8_t
**
buf
,
uint16_t
*
len
));
API
(
API_BLE_GET_ADDRESS
,
void
epic_ble_get_address
(
uint8_t
*
addr
));
API
(
API_BLE_GET_ADDRESS
,
void
epic_ble_get_address
(
uint8_t
*
addr
));
...
...
This diff is collapsed.
Click to expand it.
pycardium/modules/modbluetooth_card10.c
+
6
−
4
View file @
43bca5af
...
@@ -352,10 +352,12 @@ int mp_bluetooth_gap_advertise_start(
...
@@ -352,10 +352,12 @@ int mp_bluetooth_gap_advertise_start(
const
uint8_t
*
sr_data
,
const
uint8_t
*
sr_data
,
size_t
sr_data_len
size_t
sr_data_len
)
{
)
{
//
Temporarily going to scanner drops the connection
//
Dropping any current connection starts advertising on the card10
// TODO: modify the advertising data
// TODO: modify the advertising data
epic_ble_set_mode
(
false
,
true
);
int
connection
=
epic_ble_is_connection_open
();
epic_ble_set_mode
(
false
,
false
);
if
(
connection
>
0
)
{
epic_ble_close_connection
(
connection
);
}
return
0
;
return
0
;
}
}
...
@@ -631,7 +633,7 @@ int mp_bluetooth_gatts_set_buffer(uint16_t value_handle, size_t len, bool append
...
@@ -631,7 +633,7 @@ int mp_bluetooth_gatts_set_buffer(uint16_t value_handle, size_t len, bool append
// Disconnect from a central or peripheral.
// Disconnect from a central or peripheral.
int
mp_bluetooth_gap_disconnect
(
uint16_t
conn_handle
)
int
mp_bluetooth_gap_disconnect
(
uint16_t
conn_handle
)
{
{
raise
(
);
epic_ble_close_connection
(
conn_handle
);
return
0
;
return
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment