|
|
@ -13,13 +13,12 @@ |
|
|
|
#define MAIN_TAG "MAIN" |
|
|
|
|
|
|
|
static char bluetooth_tx_buffer[profile_b_buffer_size] = {0}; |
|
|
|
|
|
|
|
char bluetooth_rx_buffer[profile_b_buffer_size] = {0}; |
|
|
|
static char bluetooth_rx_buffer[profile_b_buffer_size] = {0}; |
|
|
|
|
|
|
|
void receipt_json_set_position(); |
|
|
|
void receipt_json_get_status(); |
|
|
|
void bluetooth_rx_buffer_format_receipt(); |
|
|
|
void bluetooth_rx_buffer_send_indicate(); |
|
|
|
void bluetooth_auto_report_format_receipt(); |
|
|
|
void bluetooth_tx_buffer_send_indicate(); |
|
|
|
void string_copy_by_num(char *dest, const char *src, uint8_t count, uint8_t num); |
|
|
|
|
|
|
|
bluetooth_processer_t s_bluetooth_processer = { |
|
|
@ -53,12 +52,12 @@ bluetooth_processer_t s_bluetooth_processer = { |
|
|
|
void app_main(void) { |
|
|
|
constructor_bluetooth_processer(&s_bluetooth_processer); |
|
|
|
|
|
|
|
bluetooth_rx_buffer_format_receipt(); |
|
|
|
bluetooth_auto_report_format_receipt(); |
|
|
|
ble_spp_server_demo_app_main(&s_bluetooth_processer); |
|
|
|
timer_group_init(TIMER_GROUP_0, TIMER_0, false, timer_group0_interval_num, timer_interval_ms); |
|
|
|
while (true) { |
|
|
|
if (s_bluetooth_processer.table_handle_m != 0) { |
|
|
|
bluetooth_rx_buffer_send_indicate(); |
|
|
|
bluetooth_tx_buffer_send_indicate(); |
|
|
|
} |
|
|
|
bluetooth_gatts_try_process_data(); |
|
|
|
if (s_bluetooth_processer.auto_report_flag) { |
|
|
@ -126,12 +125,12 @@ void receipt_json_get_status() { |
|
|
|
cJSON_Delete(pRoot); |
|
|
|
} |
|
|
|
|
|
|
|
void bluetooth_rx_buffer_format_receipt() { |
|
|
|
void bluetooth_auto_report_format_receipt() { |
|
|
|
sprintf(bluetooth_tx_buffer, "{ \"order\": \"receipt\", \"index\": %d, \"speedLevel\": %d, \"position\": %.2lf, \"direction\": %d }", // |
|
|
|
s_bluetooth_processer.index, s_bluetooth_processer.speedLevel, s_bluetooth_processer.position, s_bluetooth_processer.direction); |
|
|
|
} |
|
|
|
|
|
|
|
void bluetooth_rx_buffer_send_indicate() { |
|
|
|
void bluetooth_tx_buffer_send_indicate() { |
|
|
|
char temp_buffer[20] = {0}; |
|
|
|
uint8_t temp_lenght = 0; |
|
|
|
uint8_t temp_count_total = 0; |
|
|
|