struct at_response_code
{
uint8_t *p_string;
uint8_t event_id;
uint8_t message_id;
};
struct at_response_code frc_table[] =
{
(uint8_t*)"OK", EVENT_GSM_ACK_RESPONSE,GSM_MSG_ERROR,
(uint8_t*)"+CMS ERROR:", EVENT_GSM_ERROR_RESPONSE, GSM_MSG_ERROR,
(uint8_t*)"+CME ERROR:", EVENT_GSM_ERROR_RESPONSE,GSM_MSG_ERROR,
(uint8_t*)"ERROR", EVENT_GSM_ERROR_RESPONSE,GSM_MSG_ERROR,
// array terminator !!!
(uint8_t*) 0, 0, 0
};
static uint8_t parse_command(uint8_t* p_data, struct at_response_code *table, uint8_t* message_id)
{
struct at_response_code* p_table;
uint8_t i = 0;
uint8_t j;
p_table = &sms_table[0];
do
{
// j = strlen(&(table->p_string));
j = strlen((char*)&(table[i].p_string));
if((memcmp_P(table[i]->p_string, p_data, j)) == 0)
{
*message_id = table[i]->message_id;
return table[i]->event_id;
}
i++;
}
while(table[i]->p_string != 0);
return 0;
}
在这里,当我尝试使用 strlen 查找结构中定义的字符串的长度时,我总是收到一个错误,例如取消引用错误或指向不完整类型的指针的下标...任何人都可以帮忙