/** * Add a CBS message to the message pool. If the pool is full (i.e., there are * at least <code>MAX_CBS_MESSAGES_IN_POOL</code>), then the oldest messages are * discarded. * * @param cbsMessage The CBS message to be added. * * @return <code>WMA_OK</code> if the message was successfully added to the pool. * <code>WMA_ERR</code>, otherwise. * */ WMA_STATUS jsr120_cbs_pool_add_msg(CbsMessage* cbsMessage) { ListElement* newItem; /* If there is no message to add, bail out. */ if (cbsMessage == NULL) { return WMA_ERR; } /* Make room for this message, if necessary. */ jsr120_cbs_pool_check_quota(); /* Create the new pool item and add it to the pool. */ newItem = jsr120_list_new_by_number(NULL, cbsMessage->msgID, UNUSED_APP_ID, (void*)cbsMessage, 0); jsr120_list_add_last(&CBSPool_messages, newItem); jsr120_cbs_pool_increase_count(); return WMA_OK; }
/** * Add a MMS message to the message pool. If the pool is full (i.e., there are * at least <code>MAX_MMS_MESSAGES_IN_MMS_POOL</code>), then the oldest messages * are discarded. * * @param msg The message to be added. * * @return <code>WMA_OK</code> if the message was successfully added to the * pool. <code>WMA_ERR</code>, otherwise. */ WMA_STATUS jsr205_mms_pool_add_msg(MmsMessage* msg) { ListElement* newItem; /* If there is no message to add, bail out. */ if (msg == NULL) { return WMA_ERR; } /* Make room for this message, if necessary. */ jsr205_mms_pool_check_quota(); /* Create the new pool item and add it to the pool. */ newItem = jsr120_list_new_by_name(NULL, (unsigned char*)msg->appID, UNUSED_SUITE_ID, (void*)msg, 0); jsr120_list_add_last(&MMSPool_messages, newItem); jsr205_mms_pool_increase_msg_count(); /* Notify all listeners of the new message. */ jsr205_mms_message_arrival_notifier(msg); return WMA_OK; }