Files
firmware-test/project/ble_peripheral/ble_app_bladder_patch/cmd_parse.h
jhchun 831dbc2844 fix: BLE TX 먹통 해결 및 메모리 안전성 개선
- binary_tx_handler를 dr_binary_tx_safe로 전체 교체 (APP_ERROR_CHECK 제거)
- data_tx_handler APP_ERROR_CHECK → DBG_PRINTF 교체
- memset/memcpy 하드코딩 크기를 define 상수로 교체 (버퍼 오버런 수정)
- SERIAL_NO_LENGTH, HW_NO_LENGTH, PASSKEY_LENGTH를 main.h로 통합
- 미사용 HW 드라이버/EEPROM 코드 삭제, TWI를 i2c_manager.c로 통합
- EEPROM → FDS 전환, 코드 리뷰 현황 문서 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 16:39:26 +09:00

75 lines
2.3 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 "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 "power_control.h"
#include "tmp235_q1.h"
//#include "fstorage.h"
#include "battery_saadc.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);
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 /* */