Syntax
VM_RESULT vm_gsm_sms_get_message_id_list(
    vm_gsm_sms_query_t* query_data, 
    vm_gsm_sms_callback callback, 
    void* user_data
);
ContentsIndex
PreviousUpNext
vm_gsm_sms_get_message_id_list
Example
Syntax
VM_RESULT vm_gsm_sms_get_message_id_list(
    vm_gsm_sms_query_t* query_data, 
    vm_gsm_sms_callback callback, 
    void* user_data
);
Description

Gets the message ID list of the messages on the device through the query. The query attributes are specified in query_data. The message ID list is obtained through the callback, vm_gsm_sms_callback(), which takes vm_gsm_sms_callback_t with vm_gsm_sms_query_message_callback_t as action_data that contains the result of the query.

Parameters
Parameters 
Description 
vm_gsm_sms_query_t* query_data 
[IN] specifies the query attributes, such as sort flag, order flag and message status. 
vm_gsm_sms_callback callback 
[IN] The callback that will put the query result in the action_data. 
void* user_data 
[IN] Additional user data. 
Returns

Refer to VM_GSM_SMS_RESULT for return value and error code.

Example
void custom_sms_get_message_id_list_callback(vm_gsm_sms_callback_t* callback_data)
{
    vm_gsm_sms_query_message_callback_t* query_result;
    if(callback_data->action == VM_GSM_SMS_ACTION_QUERY)
    {
        if(callback_data->cause == VM_GSM_SMS_CAUSE_NO_ERROR)
        {
            if(!callback_data->action_data)
            {
                 vm_log_debug("SMS gets message id list action_data is NULL.");
                 return;
            }
            query_result = (vm_gsm_sms_query_message_callback_t*)callback_data->action_data;
            if(!query_result->message_id_list)
            {
                vm_log_debug("message_id_list == NULL.");
                return;
            }
            if(query_result->message_num <=0)
            {
               vm_log_debug("not find the message_id_list.");
            }
            vm_log_debug("message id list number is %d", query_result->message_num);

            // Uses the message_id_list to get message or delete message.
            vm_free(query_result->message_id_list);
        }
        else
        {
            vm_log_debug("Query message failed.");
        }
    }
}

void custom_sms_get_message_id_list_sample(void)
{
    vm_gsm_sms_query_t query_data_t;
    VMINT res = 0;
    query_data_t.sort_flag  = VM_GSM_SMS_SORT_TIMESTAMP;
    query_data_t.order_flag = VM_GSM_SMS_ORDER_ASCEND;
    query_data_t.status     = VM_GSM_SMS_STATUS_READ;
    res = vm_gsm_sms_get_message_id_list(&query_data_t,
                              custom_sms_get_message_id_list_callback, NULL);
    if(res != VM_GSM_SMS_RESULT_OK)
    {
        vm_log_debug("custom_sms_get_message_id_list_sample failed");
    }
}
File

vmgsm_sms.h

Group
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.