You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
2.7 KiB
117 lines
2.7 KiB
#pragma once
|
|
#include <stdint.h>
|
|
|
|
#include "errorcode.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define HAND_ACID_BLE_BASE_SIZE 6 //
|
|
|
|
#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;
|
|
|
|
typedef enum {
|
|
kproto_cmd_set_state = 1, // set_state
|
|
kproto_cmd_reset = 2, //
|
|
kproto_cmd_setlong_key_delayms = 3, //
|
|
kproto_cmd_read_power = 4, //
|
|
kproto_cmd_read_version = 5, //
|
|
|
|
kproto_cmd_ble_master_start_scan = 50, // process by ble master ble_master_start_scan
|
|
kproto_cmd_ble_master_enter_dfu = 51, // process by ble master ble_master_enter_dfu
|
|
kproto_cmd_ble_master_reset = 52, // process by ble master
|
|
kproto_cmd_ble_master_read_version = 53, // process by ble master
|
|
|
|
kproto_report_key_event = 101, // key_event
|
|
kproto_report_connected_event = 102, // generater by ble master and slave
|
|
kproto_report_heart = 104, //
|
|
} hand_acid_ble_proto_cmd_t;
|
|
|
|
typedef enum {
|
|
khand_acid_m_unset_mode = 0, // unset_mode
|
|
khand_acid_m_jog_mode = 1, // jog_mode
|
|
khand_acid_m_continuous_mode = 2, // continuous_mode
|
|
} hand_acid_mode_t;
|
|
|
|
typedef enum {
|
|
khand_acid_pump_is_idle = 0, //
|
|
khand_acid_pump_is_working = 1, //
|
|
} hand_pump_working_state_t;
|
|
|
|
typedef enum {
|
|
kkey_short_press_event = 0, //
|
|
kkey_long_press_event = 1, //
|
|
} key_event_t;
|
|
|
|
typedef enum {
|
|
kkey_id_mode_and_action_butt,
|
|
kkey_id_liquid_reflux_butt,
|
|
} key_id_t;
|
|
|
|
#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 {
|
|
struct {
|
|
uint8_t hand_acid_mode; // hand_acid_mode_t
|
|
uint8_t hand_pump_working_state; // hand_pump_working_state_t
|
|
} set_state;
|
|
//
|
|
struct {
|
|
uint8_t scanid[20]; // scan id
|
|
} ble_master_start_scan;
|
|
|
|
struct {
|
|
uint8_t keyid; // key_id_t
|
|
uint8_t keyevent; // key_event_t
|
|
} key_event;
|
|
|
|
struct {
|
|
uint8_t connected;
|
|
uint8_t from_ble_master;
|
|
} connected_event;
|
|
|
|
struct {
|
|
uint8_t powerlevel;
|
|
} heart;
|
|
|
|
struct {
|
|
uint32_t longkeydelay;
|
|
} setlong_key_delayms;
|
|
|
|
struct {
|
|
int32_t ecode;
|
|
} errreceipt;
|
|
|
|
struct {
|
|
int32_t power;
|
|
} read_power;
|
|
|
|
struct {
|
|
int32_t firmware_version;
|
|
int32_t blestack_version;
|
|
int32_t bootloader_version;
|
|
int32_t hardware_version;
|
|
} read_version;
|
|
|
|
} data;
|
|
} hand_acid_ble_proto_t;
|
|
#pragma pack()
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|