static char str[] = "ok\r\r\n";
#define StrLen sizeof(str)/sizeof(str[0])
static void hx_model_server_tx_cb(const hx_model_server_t * p_self, \
const uint8_t* p_data,uint8_t length)
{
app_usbd_cdc_acm_write(&m_app_cdc_acm, str, StrLen);
uint8_t* message = (uint8_t*)malloc(sizeof(uint8_t)*length);
memcpy(message,p_data,length);
free(message);
}
static uint8_t* hx_model_server_get_cb(const hx_model_server_t * p_self)
{
app_usbd_cdc_acm_write(&m_app_cdc_acm, str, StrLen);
}
static hx_model_server_t m_hx_model_server[SERVER_MODEL_INSTANCE_COUNT];
hx_server_model_callbacks_t server_callbacks = {
.get_handler = hx_model_server_get_cb,\
.tx_handler = hx_model_server_tx_cb
};
static void models_init_cb(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing and adding models\n");
app_model_init();
for(uint8_t i = 0; i <SERVER_MODEL_INSTANCE_COUNT; i++)
{
m_hx_model_server[i].p_callbacks = &server_callbacks;
uint32_t status = hx_model_server_init(&m_hx_model_server[i],i);
}
}