MSDC 4.3 接口规范(20)
- 6 Network Module Management
- 6.1 App-to-MSDC connection setup
- 6.2 Network module initialization
- 6.3 Notifications and feature opt-ins
- 6.4 Other error notifications
- 6.5 App-to-MSDC connection shutdown
6 Network Module Management
本章描述了对网络服务感兴趣的应用程序到MSDC接口的调用流程序列。
本章中的所有功能,即请求调用和通知,都是以下类中的一部分。
- IMSDCAppManager() (见第3.1节)
- IMSDCAppManagerEventListener() (见第3.1节)
- IMSDCNetworkController() (见第3.4节)
- IMSDCNetworkControllerEventListener() (见第3.4节)
- IMSDCNetworkModel() (见第3.4节)
6.1 App-to-MSDC connection setup
应用程序从这里开始,开始与MSDC沟通。
6.1.1 Add MSDC Manager module event listener
见第4.2.1节。
6.1.2 MSDC Manager module connection initialization
见第4.2.2节。
6.1.3 Get the Network module Controller and Model instances
6.1.3.1 Interface functions
IMSDCNetworkController getNetworkController()
IMSDCNetworkModel getNetworkModel()
6.1.3.2 Description
为了向MSDC的网络模块发送请求,应用程序应该使用getNetworkController()和getNetworkModel()调用来分别获得网络控制器和模型实例。
有关代码示例,请参见A.2.3节。
6.1.3.3 Call flows
6.2 Network module initialization
6.2.1 Add Network module event listener
6.2.1.1 Interface functions
void addNetworkEventListener (NetworkServiceEventListener
listener);
6.2.1.2 Description
为了从MSDC API的网络模块获取事件,应用程序必须使用addNetworkEventListener()来添加网络模块的事件监听器。
有关代码示例,请参见第A.2.4节。
6.2.1.3 Call flows
图5-5显示了添加网络模块事件监听器的调用流程。
6.2.2 Network module connection initialization
6.2.2.1 Interface functions
void initializeNetworkService ();
void networkServiceConfirmation();
void networkServiceError (int errorCode,
String message);
6.2.2.2 Prerequisites
添加网络模块事件监听器
6.2.2.3 Description
在网络模块的事件监听器被添加后,应用程序必须用initializeNetworkService()初始化与网络模块的连接。
如果MSDC的API接受了请求,并且连接初始化成功,MSDC会以networkServiceInitializeConfirmation来回应。
有关代码示例,请参见第A.2.2节和A.5.1节。
6.2.2.4 Call flows
6.2.2.4.1 Call flows Connection initialization succeeds
6.2.2.4.2 Connection initialization fails
如果网络模块连接初始化失败,MSDC API会以networkServiceError()和错误代码ERROR_NW_UNABLE_TO_INITIALIZE进行响应。
public void insufficientStorage(int serviceHandle ,String uri, String path,Long totalStorageNeeded);
6.3 Notifications and feature opt-ins
6.3.1 Broadcast coverage notification
6.3.1.1 Interface functions
void broadcastCoverageNotification(int state);
int getBroadcastCoverage();
6.3.1.2 Prerequisites
文件传递模块连接初始化
6.3.1.3 Description
如果运行MSDC的设备移入或移出LTE广播覆盖区,MSDC API会用broadcastCoverageNotification()通知应用程序,以表明这一变化。
如果 MSDC 无法访问指定位置来存储下载的文件,它会通过 inaccessibleLocation() 通知应用程序。
6.3.1.4 Call flows
6.3.2 Signal level notification
6.3.2.1 Interface functions
void enableSignalLevelMonitoring(int periodicity);
void signalLevelNotification();
void disableSignalLevelMonitoring();
void networkServiceError(int errorCode,
String message);
6.3.2.2 Prerequisites
网络模块连接初始化
6.3.2.3 Description
应用程序可以通过使用enableSignalLevelMonitoring()请求定期显示信号电平通知。它还提供以秒为单位的监测间隔参数值。
MSDC API用signalLevelNotification()来响应,它的信号电平值从0(最低)到5(最高)。超出覆盖范围事件期间的信号级别为-1。
如果应用程序给出的通知间隔是一个正值,MSDC API会继续发送signalLevelNotification()消息,并更新信号电平值。每次通知的间隔时间由周期值定义。
要禁用信号电平,请使用disableSignalLevelMonitoring()。
6.3.2.4 Call flows
6.3.2.4.1 Enable signal level
如果应用程序给出的通知间隔值小于或等于零,MSDC API将发送一次signalLevelNotification()消息。
如果MSDC不能启用信号电平通知,MSDC API会以networkServiceError()和errorcodeERROR_NW_ UNABLE_TO_ENABLE_SIGNAL_LEVEL进行响应。
6.3.2.4.2 Disable signal level notification
要禁用信号电平通知,应用程序可以使用 disableSignalLevelNotification()。如果MSDC API接受该请求,它将向应用程序返回ACCEPTED。
MSDC API不会向应用程序发送禁用确认通知,作为对该请求的响应。
如果MSDC无法禁用信号电平通知,MSDC API会以networkServiceError()和错误代码ERROR_NW_UNABLE_TO_DISABLE_SIGNAL_LEVEL作出响应。
6.3.3 Roaming notification
6.3.3.1 Interface functions
void roamingNotification (int state);
int getRoamingState();
State Enum: IN_NETWORK, OUT_OF_NETWORK
6.3.3.2 Prerequisites
网络模块连接初始化
6.3.3.3 Description
如果运行MSDC的设备在LTE广播家庭操作网络区域内或外漫游,MSDC API会用漫游通知()通知应用程序,以表明这一变化。
6.3.3.4 Call flows
6.4 Other error notifications
如果MSDC API想要通知应用程序任何网络模块的错误,它会使用重载的networkServiceError()通知。
关于不同类型的错误通知的更多信息,见第9.4节。
6.4.1 Interface functions
void networkServiceError(int errorCode,
String message);
6.4.2 Prerequisites
添加网络模块事件监听器
6.4.3 Call flows
如果MSDC的网络模块因任何原因不可用,MSDC API会以networkServiceError()和错误代码ERROR_NW_SERVICE_UNAVAILABLE回应应用程序。
6.5 App-to-MSDC connection shutdown
本节定义了应用程序用来关闭与MSDC连接的调用。
6.5.1 Close Network module connection
6.5.1.1 Interface functions
void terminateNetworkService()
6.5.1.2 Prerequisites
网络模块连接初始化
6.5.1.3 Description
为了关闭与MSDC网络模块的连接,应用程序使用terminateNetworkService()。
6.5.1.4 Call flows
6.5.2 Remove Network module event listener
6.5.2.1 Interface functions
void removeNetworkEventListener (NetworkServiceEventListener
listener);
6.5.2.2 Prerequisites
添加网络模块事件监听器
6.5.2.3 Description
要停止从网络模块获取事件,应用程序必须使用removeNetworkEventListener()删除它先前添加的事件监听器(见6.2.1节)。
6.5.2.4 Call flows
6.5.3 Close MSDC Manager module connection
见第4.6.3节。
6.5.4 Remove MSDC Manager module event listener
见第4.6.4节。