Interface IDalCommManager
-
public interface IDalCommManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description booleanaddApns(byte[] data)从XML文件新增APN。Add APN from XML file.ICommcreateUartComm(UartParam param)创建一个新的CommUartCreate a new UartComm ObjectbooleandisableMultiPath()关闭网络共享disable share network feature in system.voiddisableWifiHotspotAndHideSettings()关闭Wi-Fi热点并隐藏设置相关界面。需要如下权限:android.permission.ACCESS_WIFI_STATE android.permission.CHANGE_WIFI_STATE android.permission.CHANGE_NETWORK_STATEdisable Wi-Fi hotspot and hide Settings's UI.The following permissions are required :android.permission.ACCESS_WIFI_STATE android.permission.CHANGE_WIFI_STATE android.permission.CHANGE_NETWORK_STATEintenableChannelExclusive(EChannelType type, int timeout)启用指定通讯通道,同时会禁用其他通讯通道。Enable specified channel and disable othersbooleanenableMultiPath()在系统中启用共享网络功能。booleanenableMultiPath(int preferNetwork)系统中启用共享网络功能,并设置网络优先级。Enable the shared network function in the system and set the network priority.voidethOpen()打开以太网开关。open ethernet switch.java.util.List<ApnInfo>getApnList()获取APN列表get APN listIChannelgetChannel(EChannelType type)获得Ichannelget interface IChannelApnInfogetCurrentApn()获取当前的APNget current APNbooleangetEthernetIfaceState()获取以太网接口的状态。Get the status of the Ethernet interface.LanParamgetLanConfig()获取以太网IP地址信息。Getting IP Address Information of Ethernet.ICommgetModemComm(ModemParam param)得到CommModemget Interface CommModembytegetModemStatus()检查调制解调器状态以及电话线状态;函数立即返回。check modem status as well as telephone line status; function returns immediately.java.util.List<java.lang.String>getRouteList()获取路由集合Get routing setICommgetUartComm(UartParam param)得到一个共享的CommUartGet a shared UartComm Objectjava.util.List<EUartPort>getUartPortList()列举出所有可用的端口编号List all available port numbersbooleanisMobileEnabled()获取移动数据网络状态。Get mobile data network status.booleanisMultiPathEnabled()获取共享网络开关状态。Get shared network switch status.booleanremoveApn(java.lang.String apnId)删除apnremove APNbooleanremoveRoute(java.lang.String host, ERoute route)移除路由表里的对应信息Removes the corresponding information from the routing tablevoidsetLanParam(LanParam param)设置LanParam(会在调用使能数据通道的时候生效)set network parameters(It will take effect at the time of enableChannel)voidsetLanProxyInfo(LanProxyInfo lanProxyInfo)设置以太网网络代理。Set up the Ethernet proxy.voidsetMobileParam(MobileParam param)设置MobileParam(会在调用使能数据通道的时候生效)set the Mobile parameters(It will take effect at the time of enableChannel)booleansetRoute(java.lang.String host, ERoute route)设置网络通信方式set net socket typevoidsetWifiSleepPolicy(EWifiSleepPolicy policy)设置机器休眠时Wi-Fi休眠状态set Wi-Fi sleep policy when device sleepvoidshowWifiHotspotSettings()显示Wi-Fi热点设置UIshow Wi-Fi hotspot settings's UI.intswitchAPN(java.lang.String name, java.lang.String newApn, java.lang.String userName, java.lang.String password, int authType)新建APN并设置为当前生效APN.
-
-
-
Method Detail
-
getChannel
IChannel getChannel(EChannelType type)
获得Ichannelget interface IChannel- Parameters:
type-EChannelType- Returns:
IChannel
-
enableChannelExclusive
int enableChannelExclusive(EChannelType type, int timeout)
启用指定通讯通道,同时会禁用其他通讯通道。Enable specified channel and disable others- Parameters:
type-timeout-超时时间,单位秒, <=0 时不等待timeout, unit seconds, <=0 will not wait- Returns:
- 0 - 成功 -1 - 参数错误 -2 - 打开通道失败 -3 - 超时
- 0 -select success
- -1 -type error
- -2 -enable channel error
- -3 -wait for channel ready
-
setLanParam
void setLanParam(LanParam param)
设置LanParam(会在调用使能数据通道的时候生效)set network parameters(It will take effect at the time of enableChannel)- Parameters:
param-LanParam
-
setMobileParam
void setMobileParam(MobileParam param)
设置MobileParam(会在调用使能数据通道的时候生效)set the Mobile parameters(It will take effect at the time of enableChannel)- Parameters:
param-MobileParam
-
getModemComm
IComm getModemComm(ModemParam param)
得到CommModemget Interface CommModem- Parameters:
param-ModemParam- Returns:
IComm
-
getUartComm
IComm getUartComm(UartParam param)
得到一个共享的CommUartGet a shared UartComm Object- Parameters:
param-
-
getUartPortList
java.util.List<EUartPort> getUartPortList()
列举出所有可用的端口编号List all available port numbers- Returns:
EUartPort
-
enableMultiPath
boolean enableMultiPath()
在系统中启用共享网络功能。传统Android只允许同时存在一种网络。 当允许共享网络时,它允许同时存在多种网络,不同的网络地址可以通过调用setRoute()来指定不同的网络连接。
如果移动网络断开,目的IP地址的路由会切换到默认路由,在以上情况下,会连接WIFI。
用户应用需要注意移动网络断开的广播,以防这些情况发生。
该api主要用于WIFI(以太网)以及移动网络。Enable the shared network function in the system.Traditional Android only allows one kind of network to exist at the same time. When a shared network is allowed, it allows multiple networks to exist at the same time, and different network addresses can specify different network connections by calling setRoute().
If the mobile network is disconnected, the route of the destination IP address will switch to the default route. In the above cases, WIFI will be connected.
User applications need to be aware of mobile network disconnect broadcasts in case these situations occur.
This api is mainly used for WIFI (Ethernet) and mobile network.- Returns:
- true :成功 false : 失败true :success false : fail
-
disableMultiPath
boolean disableMultiPath()
关闭网络共享disable share network feature in system.- Returns:
- true :成功 false : 失败true :success false : fail
- Since:
- V2.00.03
-
setRoute
boolean setRoute(java.lang.String host, ERoute route)
设置网络通信方式set net socket type- Parameters:
host-目标地址host address which want to socketroute-ERoute- Returns:
- true 设置成功。 false 设置失败
- true -- success
- false -- fail
-
setWifiSleepPolicy
void setWifiSleepPolicy(EWifiSleepPolicy policy)
设置机器休眠时Wi-Fi休眠状态set Wi-Fi sleep policy when device sleep- Parameters:
policy-EWifiSleepPolicy
-
getModemStatus
byte getModemStatus()
检查调制解调器状态以及电话线状态;函数立即返回。check modem status as well as telephone line status; function returns immediately.- Returns:
- 0x00 成功
- 0x01 发送缓冲区满
- 0x02 旁置电话占用
- 0x03 电话线未接好或并线电话占用 [线电压不为 0,但过低]
- 0x33 电话线未接[线电压为 0]
- 0x83 旁置电话、并线电话均空闲(仅用于发号转人工接听方式)
- 0x04 线路载波丢失(同步建链失败)
- 0x05 拨号无应答
- 0x06 已开始发号(仅用于发号转人工接听方式)
- 0x0a 正在拨号
- 0x0b 正常挂机和空闲
- 0x0c 接收数据请求被拒绝(接收缓冲区为空)
- 0x0d 被叫线路忙
- 0xf0 (主 CPU)已无可用的通讯口(两个动态分配端口正全被其它通讯口 使用)
- 0xfd CANCEL 键按下(Modem 将终止拨号操作)
- 0xfe 无效的数据长度(len=0 或 len>2048)不会发送数据 其它 异常错误
- 0x00 -- Success
- 0x01 -- Sending buffer full
- 0x02 -- Side telephone has been occupied
- 0x03 -- Telephone line is not properly connected, or paralleled line is occupied (Line voltage is not 0, but too low)
- 0x33 -- Telephone line is not connected (Line voltage is 0)
- 0x83 -- Both side telephone and paralleled telephone are not busy (only for from automatically sending mode to manually receiving mode)
- 0x04 -- Carrier wave of telephone lost
- 0x05 -- No response for dialing
- 0x06 -- Start to send numbers (only for from automatically sending mode to manually receiving mode)
- 0x0a -- Dialing
- 0x0b -- Normal hangup and idle
- 0x0c -- Request of receiving data is denied (receiving buffer is null)
- 0x0d -- Line busy
- 0xf0 -- (The main CPU)There is no more communication port available (Two dynamically allocated ports are being used by other communication ports)
- 0xfd -- Press CANCEL key (Modem will stop dialing)
- 0xfe -- Invalid data length (len=0 or len>2048) do not send data
- others -- Abnormal errors
-
switchAPN
int switchAPN(java.lang.String name, java.lang.String newApn, java.lang.String userName, java.lang.String password, int authType)
新建APN并设置为当前生效APN.Create a new APN and set it to the currently active APN.- Parameters:
name-设置 APN 别名 (设置界面里修改接入点的名称项)。set alias (modify the name of the access point in the Settings screen).newApn-新APN名字 (设置界面里修改接入点的APN项)。set name (modify the APN item of the access point in the setting interface).userName-用户名user namepassword-密码passwordauthType-认证方式 (0:无 1:pap 2:chap 3:pap或chap)auth type(0:not have 1:pap 2:chap 3:pap or chap)- Returns:
- 1:成功 其他值:失败1:successful; other value:failed
- Since:
- V2.04.00
-
disableWifiHotspotAndHideSettings
void disableWifiHotspotAndHideSettings()
关闭Wi-Fi热点并隐藏设置相关界面。需要如下权限:android.permission.ACCESS_WIFI_STATE android.permission.CHANGE_WIFI_STATE android.permission.CHANGE_NETWORK_STATEdisable Wi-Fi hotspot and hide Settings's UI.The following permissions are required :android.permission.ACCESS_WIFI_STATE android.permission.CHANGE_WIFI_STATE android.permission.CHANGE_NETWORK_STATE
-
showWifiHotspotSettings
void showWifiHotspotSettings()
显示Wi-Fi热点设置UIshow Wi-Fi hotspot settings's UI.
-
getLanConfig
LanParam getLanConfig()
获取以太网IP地址信息。Getting IP Address Information of Ethernet.- Returns:
LanParam- Since:
- V3.02.00
-
addApns
boolean addApns(byte[] data)
从XML文件新增APN。Add APN from XML file.- Parameters:
data-data - 从APN文件得到的数据,文件格式如下:Data - Data from an APN file in the following format:
<?xml version="1.0" encoding="utf-8"?>
<apns version="8">
<apn carrier="China Mobile"
apn="cmnet"
proxy=""
port="80"
user=""
password=""
server=""
mmsc=""
mmsproxy=""
mmsport=""
mcc="460"
mnc="00"
authtype="3"
type="default"
protocol="IPV4V6"
roaming_protocol="IPV4V6"
/>
<apn carrier="China MobileTTT"
apn="cmnet"
proxy=""
port="80"
user=""
password=""
server=""
mmsc=""
mmsproxy=""
mmsport=""
mcc="460"
mnc="01"
authtype="3"
type="default"
protocol="IPV4V6"
roaming_protocol="IPV4V6"
/>
</apns>- Returns:
- true:成功 false:失败true:success false:failed
-
getApnList
java.util.List<ApnInfo> getApnList()
获取APN列表get APN list- Returns:
- APN列表APN list
-
getCurrentApn
ApnInfo getCurrentApn()
获取当前的APNget current APN- Returns:
- 当前的APNcurrent APN
-
removeApn
boolean removeApn(java.lang.String apnId)
删除apnremove APN- Parameters:
apnId-要删除的apnId,可通过getCurrentApn或getApnList获取- Returns:
- true:成功 false:失败true:success false:failed
-
removeRoute
boolean removeRoute(java.lang.String host, ERoute route)
移除路由表里的对应信息Removes the corresponding information from the routing table- Parameters:
host-主机地址host addressroute-ERoute- Returns:
- true:成功 false:失败true:success false:failed
- Since:
- V3.06.00
-
getRouteList
java.util.List<java.lang.String> getRouteList()
获取路由集合Get routing set- Returns:
- 路由集合Routing collection
- Since:
- V3.06.00
-
createUartComm
IComm createUartComm(UartParam param)
创建一个新的CommUartCreate a new UartComm Object- Parameters:
param-- Since:
- V3.10.00
-
getEthernetIfaceState
boolean getEthernetIfaceState()
获取以太网接口的状态。Get the status of the Ethernet interface.- Returns:
- true:开启;false: 关闭。true: open; false: close.
- Since:
- V3.24.00
-
setLanProxyInfo
void setLanProxyInfo(LanProxyInfo lanProxyInfo)
设置以太网网络代理。Set up the Ethernet proxy.- Parameters:
lanProxyInfo-LanProxyInfo- Since:
- V3.25.00
-
enableMultiPath
boolean enableMultiPath(int preferNetwork)
系统中启用共享网络功能,并设置网络优先级。Enable the shared network function in the system and set the network priority.- Parameters:
preferNetwork-0:表示移动网络优先级大于WIFI.0: Indicates that the mobile network priority is greater than WIFI.- Returns:
- 成功时返回true,失败时返回false。It returns true on success, and false on failure.
- Since:
- V3.27.00
-
isMobileEnabled
boolean isMobileEnabled()
获取移动数据网络状态。Get mobile data network status.- Returns:
- 打开返回true,关闭返回false。On returns true, off returns false.
- Since:
- V3.33.00
-
isMultiPathEnabled
boolean isMultiPathEnabled()
获取共享网络开关状态。Get shared network switch status.- Returns:
- true 共享网络已打开,false 共享网络已禁用。true: share network is enabled, false: share network is disabled.
- Since:
- V4.07.00
-
ethOpen
void ethOpen()
打开以太网开关。open ethernet switch.
-
-