Files
VesiScan-Basic-firmware-test/project/ble_peripheral/ble_app_bladder_patch/cmd_parse.h
Charles Kwon 72f5eb3cd9 Initial commit: MT firmware project
- BLE peripheral applications
- dr_piezo and bladder_patch projects

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 17:26:39 +09:00

91 lines
2.7 KiB
C

/*******************************************************************************
* @file cmd_parse.h
* @brief
******************************************************************************/
#ifndef _CMD_PARSE_H_
#define _CMD_PARSE_H_
#include "sdk_config.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include "nordic_common.h"
#include "nrf.h"
#include "ble_hci.h"
#include "ble_advdata.h"
#include "ble_advertising.h"
#include "ble_conn_params.h"
#include "nrf_sdh.h"
#include "nrf_sdh_soc.h"
#include "nrf_sdh_ble.h"
#include "nrf_ble_gatt.h"
#include "nrf_ble_qwr.h"
#include "app_timer.h"
#include "ble_nus.h"
#include "app_uart.h"
#include "app_util_platform.h"
#include "bsp_btn_ble.h"
#include "nrf_pwr_mgmt.h"
#include "nrf_delay.h"
#include "math.h"
#include "crc16.h" //add 25.04.23
#include "nrf_ble_lesc.h"
#include "cat_interface.h"
#include "ir_i2c.h"
#include "nrf_crypto.h"
#include "nrf_pwr_mgmt.h"
#include <ctype.h>
#include "system_interface.h"
#include "main.h"
#include "app_raw_main.h" //0117
#include "main_timer.h"
#include "ad5272_i2c.h"
#include "ada2200_spi.h"
#include "power_control.h"
#include "tmp235_q1.h"
#include "mcp4725_i2c.h"
#include "measurements.h"
//#include "fstorage.h"
#include "battery_saadc.h"
#include "mcp4725_adc.h"
#include "meas_pd_voltage_simple.h"
#include "meas_pd_voltage_half.h"
#include "meas_pd_voltage_full.h"
#include "full_agc.h"
//#include "meas_pd_voltage_custom.h"
#include "meas_pd_imm.h"
#include "meas_pd_48.h"
typedef struct {
char tag[5]; // Null-terminated 4-char command
uint16_t value0; // Data value
uint16_t value1; // Data value
uint16_t value2; // Data value
uint16_t value3; // Data value
uint16_t value4; // Data value
char value_ascii[13];
uint8_t values[24]; // data vlue
// uint16_t crc; // CRC value
} ParsedCmd;
uint32_t serial_to_passkey_hash(const char *input);
void received_command_process(uint8_t const *data_array, which_cmd_t cmd_t,uint8_t length);
bool length_error(const char *cmd , uint8_t target_length, uint8_t length);
bool parse_cmd(const uint8_t *buffer, ParsedCmd *cmd_out,uint8_t length);
bool activate_error(const char *cmd , bool device_status);
void param_error(const char *cmd );
void quest_error(const char *cmd );
bool is_valid_serial_no(const char *serial);
bool is_valid_passkey(const char *passkey);
ret_code_t eeprom_init_values_read(void);
bool crc16_check(uint8_t const * p_data, uint32_t data_len, uint16_t expected_crc);
bool crc16_check_packet(uint8_t const * packet, uint32_t packet_len);
#endif /* */