15 changed files with 154 additions and 283 deletions
-
3.vscode/settings.json
-
3app_protocols/app_protocols.h
-
5app_protocols/bean/hand_acid_remoter_key_event.h
-
54app_protocols/ble_through/ble_cmd_app.h
-
71app_protocols/ble_through/ble_cmd_public.h
-
89app_protocols/ble_through/ble_proto.h
-
54app_protocols/ble_through/ble_proto_packet.h
-
66app_protocols/ble_through/ble_proto_utils.c
-
22app_protocols/ble_through/ble_proto_utils.h
-
1uappbase/appdep.hpp
-
2uappbase/base.hpp
-
50usrc/service/remote_controler.cpp
-
11usrc/service/remote_controler.hpp
-
4usrc/service/remote_controler_event_processer.cpp
-
2usrc/service/remote_controler_event_processer.hpp
@ -0,0 +1,5 @@ |
|||
#pragma once |
|||
typedef enum { |
|||
hand_acid_remoter_kevent_add_liquid = 0, // |
|||
hand_acid_remoter_kevent_change_next_mode = 1, // |
|||
} hand_acid_remoter_key_event_t; |
@ -1,54 +0,0 @@ |
|||
#pragma once |
|||
#include <stdbool.h> |
|||
#include <stdint.h> |
|||
// |
|||
#include "app_protocols/bean/hand_acid_mode.h" |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/** |
|||
* @brief |
|||
* |
|||
* cmd: |
|||
* 000->049 app_cmd |
|||
* 050->099 app_event_report |
|||
* |
|||
* 100->149 public_cmd |
|||
* 150->199 public_event_report |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
typedef enum { |
|||
kble_app_proto_cmd_sync_state = 1, // set_state |
|||
kble_app_proto_cmd_trigger_pump_start_event = 3, // |
|||
kble_app_proto_cmd_trigger_pump_stop_event = 4, // |
|||
kble_app_proto_cmd_trigger_reflux_start_event = 5, // |
|||
kble_app_proto_cmd_trigger_reflux_stop_event = 6, // |
|||
kble_app_proto_cmd_trigger_prepare_start_event = 7, // |
|||
kble_app_proto_cmd_trigger_prepare_stop_event = 8, // |
|||
kble_app_proto_cmd_read_version = 9, // |
|||
|
|||
kble_app_proto_report_reflux_butt_short_press_event = 50, // key_event |
|||
kble_app_proto_report_reflux_butt_long_press_event = 51, // key_event |
|||
kble_app_proto_report_action_butt_short_press_event = 52, // key_event |
|||
kble_app_proto_report_action_butt_long_press_event = 53, // key_event |
|||
kble_app_proto_report_client_heart = 54, // |
|||
|
|||
} ble_app_proto_cmd_t; |
|||
/*********************************************************************************************************************** |
|||
* ENUM * |
|||
***********************************************************************************************************************/ |
|||
typedef struct { |
|||
uint8_t mode; |
|||
} ble_app_proto_cmd_sync_state_t; |
|||
|
|||
typedef struct { |
|||
uint8_t placeholder; |
|||
} ble_app_proto_report_client_heart_t; |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
@ -1,71 +0,0 @@ |
|||
#pragma once |
|||
#include <stdbool.h> |
|||
#include <stdint.h> |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/** |
|||
* @brief |
|||
* |
|||
* cmd: |
|||
* 000->049 app_cmd |
|||
* 050->099 app_event_report |
|||
* |
|||
* 100->149 public_cmd |
|||
* 150->199 public_event_report |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
typedef enum { |
|||
|
|||
kproto_cmd_ble_master_reset = 100, // process by ble master |
|||
kproto_cmd_ble_master_read_version = 101, // process by ble master ble_read_version_t |
|||
kproto_cmd_ble_master_start_scan = 102, // process by ble master |
|||
kproto_cmd_ble_master_stop_scan = 103, // process by ble master |
|||
kproto_cmd_ble_master_enter_dfu = 104, // process by ble master |
|||
kproto_cmd_ble_master_clear_reset_flag = 105, // process by ble master |
|||
|
|||
kproto_report_ble_master_connected_event = 150, // generator from ble master ble_connected_event_t |
|||
kproto_report_ble_master_scan_result = 151, // generator from ble master ble_scan_result_t |
|||
kproto_report_ble_master_power_on = 152, // generator from ble master ble_scan_result_t |
|||
kproto_report_ble_master_heart = 153, // generator from ble master ble_scan_result_t |
|||
|
|||
} ble_proto_public_cmd_t; |
|||
/*********************************************************************************************************************** |
|||
* ENUM * |
|||
***********************************************************************************************************************/ |
|||
typedef struct { |
|||
uint8_t auto_connect; |
|||
uint8_t auto_connect_client_name[20]; |
|||
} ble_master_start_scan_t; |
|||
|
|||
typedef struct { |
|||
uint8_t connected; |
|||
char blename[20]; |
|||
char bleid[20]; |
|||
} ble_master_connected_event_t; |
|||
|
|||
typedef struct { |
|||
char blename[20]; |
|||
char bleid[20]; |
|||
uint8_t rssi; |
|||
} ble_master_scan_result_t; |
|||
|
|||
typedef struct { |
|||
int32_t firmware_version; |
|||
int32_t blestack_version; |
|||
int32_t bootloader_version; |
|||
int32_t hardware_version; |
|||
} ble_master_read_version_t; |
|||
|
|||
typedef struct { |
|||
uint8_t reset_flag; |
|||
uint8_t connected_flag; |
|||
} ble_master_heart_t; |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
@ -1,54 +0,0 @@ |
|||
#pragma once |
|||
#include <stdbool.h> |
|||
#include <stdint.h> |
|||
// |
|||
#include "ble_cmd_app.h" |
|||
#include "ble_cmd_public.h" |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
#define PACKET_H1 (0xAA) |
|||
#define PACKET_H2 (0xBB) |
|||
#define PACKET_TAIL (0xCC) |
|||
typedef enum { |
|||
kproto_cmd = 1, |
|||
kproto_cmd_receipt = 2, |
|||
kproto_report = 3, |
|||
kproto_error_receipt = 4, |
|||
} hand_acid_ble_proto_packet_type_t; |
|||
|
|||
/*********************************************************************************************************************** |
|||
* ENUM * |
|||
***********************************************************************************************************************/ |
|||
|
|||
#pragma pack(1) |
|||
typedef struct { |
|||
uint8_t h1; |
|||
uint8_t h2; |
|||
uint8_t packetlen; |
|||
uint8_t frame_type; |
|||
uint8_t frame_index; |
|||
uint8_t cmd; |
|||
union { |
|||
// °üÀàÈÝ |
|||
ble_master_start_scan_t ble_master_start_scan; |
|||
ble_master_connected_event_t ble_master_connected_event; |
|||
ble_master_scan_result_t ble_master_scan_result; |
|||
ble_master_read_version_t ble_master_read_version; |
|||
ble_master_heart_t ble_master_heart; |
|||
uint8_t placeholder; |
|||
int32_t errorcode; |
|||
} d; |
|||
} ble_through_proto_t; |
|||
|
|||
#pragma pack() |
|||
|
|||
#define BLE_PACKET_BASE_SIZE() (sizeof(ble_through_proto_t) - sizeof(((ble_through_proto_t*)(0))->d) + 2) |
|||
|
|||
#define BLE_PACKET_MAX_SIZE() (230) |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
@ -1,32 +1,30 @@ |
|||
#pragma once |
|||
|
|||
#include "ble_proto_packet.h" |
|||
#include "ble_proto.h" |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
bool ble_through_proto_check_packet(ble_through_proto_t *packet); |
|||
uint8_t ble_through_proto_sum(ble_through_proto_t *packet); |
|||
|
|||
#define BLE_THROUGH_PACKET_SET_TAIL(packet) \ |
|||
{ \ |
|||
uint8_t *__data = (uint8_t *)packet; \ |
|||
__data[packet->packetlen - 1] = PACKET_TAIL; \ |
|||
} |
|||
|
|||
#define BLE_THROUGH_PACKET_SET_CHECKSUM(packet) \ |
|||
{ \ |
|||
uint8_t *__data = (uint8_t *)packet; \ |
|||
#define BLE_THROUGH_PACKET_SET_CHECKSUM(packet) \ |
|||
{ \ |
|||
uint8_t *__data = (uint8_t *)packet; \ |
|||
__data[packet->packetlen - 2] = ble_through_proto_sum(packet); \ |
|||
} |
|||
|
|||
typedef struct { |
|||
uint8_t cmd; |
|||
uint8_t length; |
|||
} cmd_info_t; |
|||
#define BLE_THROUGH_PACKET_BASE_SIZE() (sizeof(zble_proto_packet_t) + 1) |
|||
|
|||
bool ble_through_proto_check_packet(zble_proto_packet_t *packet); |
|||
uint8_t ble_through_proto_sum(zble_proto_packet_t *packet); |
|||
|
|||
cmd_info_t *getcmdinfo(uint8_t cmd); |
|||
void zble_proto_utils_create_cmd_packet(zble_proto_packet_t *packet, uint16_t cmd, uint8_t index, uint8_t *data, int32_t datalen); |
|||
void zble_proto_utils_create_cmd_packet_int32(zble_proto_packet_t *packet, uint16_t cmd, uint8_t index, int32_t *data, int32_t ndata); |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue