LTE教程
LTE教程
1. 概述
为满足用户在多个领域进行无人机远距离作业的需求,MSDK开放了无人机的LTE功能。LTE功能的开启能够保证图传的稳定性。LTE管理器提供了LTE功能开关状态,域名,密码,用户名等方法的设置以及获取方法。
2. 接口调用说明
2.1 LTE开关状态
设置LTE开启,示例代码如下:
LTEManager.get().setLTEModuleEnable(isEnable = true,
onSuccess = {
updateLogInfo("open lte module success")
}, onFailure = { code, msg ->
updateLogInfo("open lte module onFailure:[code:$code;msg:$msg]")
})
获取LTE开关状态代码如下:
LTEManager.get().getLTEModuleEnable(onSuccess = { state ->
updateLogInfo("get lte module enable state:$state")
}, onFailure = { code, msg ->
updateLogInfo("get lte module enable state onFailure:[code:$code;msg:$msg]")
})
2.2 LTE域名
设置LTE域名,示例代码如下:
LTEManager.get().setLTEAPNDomainName(domainName = "test domain name",
onSuccess = {
updateLogInfo("set domain name success")
}, onFailure = { code, msg ->
updateLogInfo("set domain name onFailure:[code:$code;msg:$msg]")
})
获取LTE域名,示例代码如下:
LTEManager.get().getLTEAPNDomainName(onSuccess = { domain ->
updateLogInfo("get lte domain name onSuccess:[$domain]")
}, onFailure = { code, msg ->
updateLogInfo("get lte domain name failure:[code:$code;msg:$msg]")
})
2.3 LTE用户名
设置LTE用户名,示例代码:
LTEManager.get().setLTEAPNUserName(userName = "test userName",
onSuccess = {
updateLogInfo("set username success")
}, onFailure = { code, msg ->
updateLogInfo("set username onFailure:[code:$code;msg:$msg]")
})
获取LTE用户名,示例代码:
LTEManager.get().getLTEAPNUserName(onSuccess = { userName ->
updateLogInfo("get lte userName onSuccess:[$userName]")
}, onFailure = { code, msg ->
updateLogInfo("get lte userName onFailure:[code:$code;msg:$msg]")
})
2.4 LTE密码
设置LTE密码,示例代码如下:
LTEManager.get().setLTEAPNPsd(passWord = "test passWord",
onSuccess = {
updateLogInfo("set password success")
}, onFailure = { code, msg ->
updateLogInfo("set password onFailure:[code:$code;msg:$msg]")
})
获取LTE密码,示例代码如下:
LTEManager.get().getLTEAPNPsd(onSuccess = { passWord ->
updateLogInfo("get lte passWord onSuccess:[$passWord]")
}, onFailure = { code, msg ->
updateLogInfo("get lte passWord onFailure:[code:$code;msg:$msg]")
})
2.5 获取LTE授权码
示例代码:
LTEManager.get().getLTECcid(onSuccess = { ccid ->
updateLogInfo("get ccid onSuccess:[$ccid]")
}, onFailure = { code, msg ->
updateLogInfo("get ccid onFailure:[code:$code;msg:$msg]")
})
2.6 获取LTE手机号码
示例代码如下:
LTEManager.get().getLTEPhoneNumber(onSuccess = { phone ->
updateLogInfo("get phone onSuccess:[$phone]")
}, onFailure = { code, msg ->
updateLogInfo("get phone onFailure:[code:$code;msg:$msg]")
})
3.Sample获取
参考Sample中LteFragment
4.接口说明
/**
* Copyright: Autel Robotics
* @author R24033 on 2024/10/18
* LTE 管理类
*/
interface ILTEManager {
/**
* 设置LTE模块开关状态
* @param isEnable
* @param onSuccess
* @param onFailure
*/
fun setLTEModuleEnable(
isEnable: Boolean,
onSuccess: () -> Unit,
onFailure: (code: IAutelCode?, msg: String?) -> Unit
)
/**
* 获取LTE模块开关状态
* @param onSuccess
* @param onFailure
*/
fun getLTEModuleEnable(
onSuccess: (Boolean) -> Unit,
onFailure: (code: IAutelCode?, msg: String?) -> Unit
)
/**
* 设置LTE APN域名
* @param domainName
* @param onSuccess
* @param onFailure
*/
fun setLTEAPNDomainName(
domainName: String,
onSuccess: () -> Unit,
onFailure: (code: IAutelCode?, msg: String?) -> Unit
)
/**
* 获取LTE APN域名
* @param onSuccess
* @param onFailure
*/
fun getLTEAPNDomainName(
onSuccess: (String?) -> Unit,
onFailure: (code: IAutelCode?, msg: String?) -> Unit
)
//LTE_APN_USERNAME
/**
* 设置LTE APN 用户名
* @param userName
* @param onSuccess
* @param onFailure
*/
fun setLTEAPNUserName(
userName: String,
onSuccess: () -> Unit,
onFailure: (code: IAutelCode?, msg: String?) -> Unit
)
/**
* 获取LTE APN 用户名
* @param onSuccess
* @param onFailure
*/
fun getLTEAPNUserName(
onSuccess: (String?) -> Unit,
onFailure: (code: IAutelCode?, msg: String?) -> Unit
)
//LTE_APN_PASSWORD
/**
* 设置LTE APN 密码
* @param passWord
* @param onSuccess
* @param onFailure
*/
fun setLTEAPNPsd(
passWord: String,
onSuccess: () -> Unit,
onFailure: (code: IAutelCode?, msg: String?) -> Unit
)
/**
* 获取LTE APN 密码
* @param onSuccess
* @param onFailure
*/
fun getLTEAPNPsd(
onSuccess: (String?) -> Unit,
onFailure: (code: IAutelCode?, msg: String?) -> Unit
)
//LTE_CCID
/**
* 获取LTE 唯一认证码
* @param onSuccess
* @param onFailure
*/
fun getLTECcid(
onSuccess: (String?) -> Unit,
onFailure: (code: IAutelCode?, msg: String?) -> Unit
)
//LTE_PHONENUMBER
/**
* 获取LTE 手机号码
* @param onSuccess
* @param onFailure
*/
fun getLTEPhoneNumber(
onSuccess: (String?) -> Unit,
onFailure: (code: IAutelCode?, msg: String?) -> Unit
)
}