MMI 不使用 this buffer 和L4通信
construct_peer_buff(pdu_len, header_len, tail_len, direction);
当L4接收到消息并处理完成后,会自动释放参数。
free_peer_buff(peer_buff);
例程如下:
Set a volume request:
void SetVolumeLevelReq(volume_type_enum volume_type,U8 volume_level)
{
MYQUEUE Message;
mmi_eq_set_volume_req_struct *setVolumeLevelReq;
Message.oslMsgId = MSG_ID_MMI_EQ_SET_VOLUME_REQ;
//Message ID, reference the l4a.h file
setVolumeLevelReq = OslConstructDataPtr(sizeof(mmi_eq_set_volume_req_struct));
//Create local parameter buffer
setVolumeLevelReq->volume_type = volume_type;
setVolumeLevelReq->volume_level = volume_level;
Message.oslDataPtr = (oslParaType *)setVolumeLevelReq; //Local parameter buffer
Message.oslPeerBuffPtr= NULL; //Peer parameter buffer
Message.oslSrcId=MOD_MMI; //Send from Source module
Message.oslDestId=MOD_L4C; //Send to destination module
OslMsgSendExtQueue(&Message); //Send to L4 task
}
每个功能的具体实现(比如说播放音频)都会定义mmi_xxxxx_reg_sturct形式结构体
结构体组成:Header info + Data info:
例如(请求播放音频):
typedef struct
{
LOCAL_PARA_HDR //头信息(Header info)
kal_uint8 sound_id;
kal_uint8 style; /* audio_play_style_enum */
} mmi_eq_play_audio_req_struct;
#define MYQUEUE ilm_struct
typedef struct ilm_struct {
oslModuleType oslSrcId; // Source module ID.
oslModuleType oslDestId; // Destination module ID.
oslMsgType oslSapId; // service access point.
oslMsgType oslMsgId; // message name ID.
oslParaType *oslDataPtr; //local parameter buffer
oslPeerParaPtr *oslPeerBuffPtr; //peer buffer pointer
} ilm_struct;
{
MYQUEUE Message;
mmi_eq_play_audio_req_struct *audioPlayReq;
//create local parameter buffer
audioPlayReq = OslConstructDataPtr(sizeof(mmi_eq_play_audio_req_struct));
audioPlayReq->sound_id = (U8) soundId;
audioPlayReq->style = 2; /* style; */
audioPlayReq->identifier = (U16) soundId;
Message.oslMsgId = PRT_EQ_PLAY_AUDIO_REQ; //message id,reference the l4a.h
Message.oslDataPtr = (oslParaType*) audioPlayReq; //local parameter buffer
Message.oslPeerBuffPtr = NULL; //Peer parameter buffer
Message.oslSrcId = MOD_MMI; //Send from Source module
Message.oslDestId = MOD_L4C; //Send to destination module
OslMsgSendExtQueue(&Message); //Send to L4 task
}
MMI : Man machine Interface
PMS : Pixtel MMI Simulator
NWS : Network Simulator (MMINWSimulator)
DTD : Document Type Definition
XML : Extensible Markup Language
PMS
|
NWS
|
XML (Sends Automatic and Manual Messages) |
Plugins |
Data File |
Icoming messages |
Outgoing messages |
Asvc Events |
Via File I/O |
Calls |
Return data |
1. 联系NWS 和 PMS,模拟MMI 和 协议栈之间的通讯
2. 在数据文件中存储数据来模拟Flash中的数据存储
NWS 同 PMS之间通过三种方式通信
1. 接收从PMS发送给NWS的 incoming messages 例如,拨号请求
2. 对incoming message从NWS发送outgoing message到PMS 例如,获得电话薄入口请求
3. 从NWS发送异步消息到PMS 例如,Boot Up等。