Coments on SMSTest Sample

SMSTest is a demo application of MAGIC101 network coding. In MAGIC101 network engine class interface is 'MAGNetworkBase'. The functionality of 'MAGNetworkBase' can be divided roughly into 4 categories:

1) Initalisation and uninitialistion.

2) Data transfering.

3)Session management.

4) Network event call back and feedback.

MAGIC101 network is con work on 'Connected' or 'None-Connected' network. SMS/MMS are all 'None-Coneected' while TCP/Bule-tooth are 'Connected'.

A MAGNetworkBase object can be create by CreateNetwork() function of MAGEngine class. A MAGEngine object will be gived to InitApp() function of a MAGApp object as a param. (see SMSMainApp.cpp, Line 69). In current MAGIC101 Beta4 only SMS are supported.

Each network game shuold have is own 'NetworkID'. 'NetworkID' can be set by MAGNetworkBase::SetNetID() function.(see SMSMainApp.cpp Line 72).

To get network events and feedback, a class must implement the interface 'MAGNetworkObserver'. When a network event or feedback happens, MAGNetworkObserver::NetworkEvent() function will be called. In SMSTest sample, SMSHostUI, SMSJoinUI, SMSPlayUI all implemented 'MAGNetworkObserver'. Use MAGNetworkBase::SetObserver() to set current network observer.(see SMSPlayUI.cpp line 97). A NetworkOberserver object must check if current network observer is itself before it be destoried. (see SMSPlayUI.cpp line 35-39).

To avoid multi-threading, MAGNetworkBase::UpdateNetwork() shuold be called by user every frame.(see SMSMainApp.cpp line 137)

When MAGIC101 got a network message, it will call current network observer's NetworkEvent() with mssage: MAGNT_MSG_MSGRECEIVED. Then you can get the message content by call MAGNetworkBase::Receive(). See SMSPlayUI::NetworkEvent() function.

To send a message, you can call MAGNetwork::Send() funcation. (See SMSPlayUI.cpp line 189).

To be continued.