#if !defined(__SYS_BLE_C_H)

#define __SYS_BLE_C_H


#ifdef  __cplusplus
extern "C" {
#endif
 
  
#define SYS_BLE_C_MSG_BUF_SIZE            256
#define SYS_BLE_C_DATA_SEND_RETRY_LIMIT   50  // retry limit of ble_nus_data_send()
  
#define SYS_BLE_C_ASYNC                   true
#define SYS_BLE_C_BLOCKING                false
  
  
typedef struct
{
    char        rx_buf[SYS_BLE_C_MSG_BUF_SIZE];
    
    bool        connected;
    bool        command_ready;
    // bool        base64_enabled;
} sys_ble_c_state, *psys_ble_c_state;
  

int         sys_ble_c_init(void);

char *      sys_ble_c_get_command(void);
bool        sys_ble_c_is_command_ready(void);
void        sys_ble_c_clear_command_ready(void);

// void        sys_ble_c_enable_base64(void);
// void        sys_ble_c_disable_base64(void);

int         sys_ble_c_send_data(char *data, uint16_t len, bool is_async);
int         sys_ble_c_send_message(char *message, bool is_async);
int         sys_ble_c_printf(bool is_async, const char *fmt, ...);


extern sys_ble_c_state    __sys_ble_c;


#define SYS_BLE_C_IS_CONNECTED()      __sys_ble_c.connected
#define SYS_BLE_C_SET_CONNECTED()     __sys_ble_c.connected = true


#ifdef  __cplusplus
}
#endif


#endif
