mirror of
https://gitee.com/openharmony/base_location
synced 2024-12-03 12:42:31 +00:00
添加LocationAgentManager类方法返回值
Signed-off-by: zzhangkai <zhangkai284@huawei.com>
This commit is contained in:
parent
b81f60272f
commit
e0505d5ee7
@ -42,91 +42,97 @@ LocatorAgentManager::LocatorAgentManager()
|
||||
LocatorAgentManager::~LocatorAgentManager()
|
||||
{}
|
||||
|
||||
void LocatorAgentManager::StartGnssLocating(const LocationCallbackIfaces& callback)
|
||||
LocationErrCode LocatorAgentManager::StartGnssLocating(const LocationCallbackIfaces& callback)
|
||||
{
|
||||
if (locationCallbackHost_ == nullptr) {
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s callback is nullptr", __func__);
|
||||
return;
|
||||
return ERRCODE_INVALID_PARAM;
|
||||
}
|
||||
auto proxy = GetLocatorAgent();
|
||||
if (proxy == nullptr) {
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s get proxy failed.", __func__);
|
||||
return;
|
||||
return ERRCODE_INVALID_PARAM;
|
||||
}
|
||||
locationCallbackHost_->SetCallback(callback);
|
||||
auto locatorCallback = sptr<ILocatorCallback>(locationCallbackHost_);
|
||||
LocationErrCode ret = proxy->StartGnssLocating(locatorCallback);
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
LBSLOGI(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void LocatorAgentManager::StopGnssLocating()
|
||||
LocationErrCode LocatorAgentManager::StopGnssLocating()
|
||||
{
|
||||
auto proxy = GetLocatorAgent();
|
||||
if (proxy == nullptr) {
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s get proxy failed.", __func__);
|
||||
return;
|
||||
return ERRCODE_INVALID_PARAM;
|
||||
}
|
||||
auto locatorCallback = sptr<ILocatorCallback>(locationCallbackHost_);
|
||||
LocationErrCode ret = proxy->StopGnssLocating(locatorCallback);
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
LBSLOGI(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void LocatorAgentManager::RegisterGnssStatusCallback(const SvStatusCallbackIfaces& callback)
|
||||
LocationErrCode LocatorAgentManager::RegisterGnssStatusCallback(const SvStatusCallbackIfaces& callback)
|
||||
{
|
||||
if (gnssCallbackHost_ == nullptr) {
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s callback is nullptr", __func__);
|
||||
return;
|
||||
return ERRCODE_INVALID_PARAM;
|
||||
}
|
||||
auto proxy = GetLocatorAgent();
|
||||
if (proxy == nullptr) {
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s get proxy failed.", __func__);
|
||||
return;
|
||||
return ERRCODE_INVALID_PARAM;
|
||||
}
|
||||
gnssCallbackHost_->SetCallback(callback);
|
||||
auto gnssCallback = sptr<IGnssStatusCallback>(gnssCallbackHost_);
|
||||
LocationErrCode ret = proxy->RegisterGnssStatusCallback(gnssCallback);
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
LBSLOGI(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void LocatorAgentManager::UnregisterGnssStatusCallback()
|
||||
LocationErrCode LocatorAgentManager::UnregisterGnssStatusCallback()
|
||||
{
|
||||
auto proxy = GetLocatorAgent();
|
||||
if (proxy == nullptr) {
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s get proxy failed.", __func__);
|
||||
return;
|
||||
return ERRCODE_INVALID_PARAM;
|
||||
}
|
||||
auto gnssCallback = sptr<IGnssStatusCallback>(gnssCallbackHost_);
|
||||
LocationErrCode ret = proxy->UnregisterGnssStatusCallback(gnssCallback);
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
LBSLOGI(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void LocatorAgentManager::RegisterNmeaMessageCallback(const GnssNmeaCallbackIfaces& callback)
|
||||
LocationErrCode LocatorAgentManager::RegisterNmeaMessageCallback(const GnssNmeaCallbackIfaces& callback)
|
||||
{
|
||||
if (nmeaCallbackHost_ == nullptr) {
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s callback is nullptr", __func__);
|
||||
return;
|
||||
return ERRCODE_INVALID_PARAM;
|
||||
}
|
||||
auto proxy = GetLocatorAgent();
|
||||
if (proxy == nullptr) {
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s get proxy failed.", __func__);
|
||||
return;
|
||||
return ERRCODE_INVALID_PARAM;
|
||||
}
|
||||
nmeaCallbackHost_->SetCallback(callback);
|
||||
auto nmeaCallback = sptr<INmeaMessageCallback>(nmeaCallbackHost_);
|
||||
LocationErrCode ret = proxy->RegisterNmeaMessageCallback(nmeaCallback);
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
LBSLOGI(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void LocatorAgentManager::UnregisterNmeaMessageCallback()
|
||||
LocationErrCode LocatorAgentManager::UnregisterNmeaMessageCallback()
|
||||
{
|
||||
auto proxy = GetLocatorAgent();
|
||||
if (proxy == nullptr) {
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s get proxy failed.", __func__);
|
||||
return;
|
||||
return ERRCODE_INVALID_PARAM;
|
||||
}
|
||||
auto nmeaCallback = sptr<INmeaMessageCallback>(nmeaCallbackHost_);
|
||||
LocationErrCode ret = proxy->UnregisterNmeaMessageCallback(nmeaCallback);
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
LBSLOGI(LOCATOR_STANDARD, "%{public}s ret = %{public}d", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
sptr<LocatorAgent> LocatorAgentManager::GetLocatorAgent()
|
||||
|
@ -58,36 +58,36 @@ public:
|
||||
*
|
||||
* @param callback Indicates the callback for reporting the location result.
|
||||
*/
|
||||
void StartGnssLocating(const LocationCallbackIfaces& callback);
|
||||
LocationErrCode StartGnssLocating(const LocationCallbackIfaces& callback);
|
||||
|
||||
/**
|
||||
* @brief Subscribe satellite status changed.
|
||||
*
|
||||
* @param callback Indicates the callback for reporting the satellite status.
|
||||
*/
|
||||
void RegisterGnssStatusCallback(const SvStatusCallbackIfaces& callback);
|
||||
LocationErrCode RegisterGnssStatusCallback(const SvStatusCallbackIfaces& callback);
|
||||
|
||||
/**
|
||||
* @brief Subscribe nmea message changed.
|
||||
*
|
||||
* @param callback Indicates the callback for reporting the nmea message.
|
||||
*/
|
||||
void RegisterNmeaMessageCallback(const GnssNmeaCallbackIfaces& callback);
|
||||
LocationErrCode RegisterNmeaMessageCallback(const GnssNmeaCallbackIfaces& callback);
|
||||
|
||||
/**
|
||||
* @brief Unsubscribe location changed.
|
||||
*/
|
||||
void StopGnssLocating();
|
||||
LocationErrCode StopGnssLocating();
|
||||
|
||||
/**
|
||||
* @brief Unsubscribe nmea message changed.
|
||||
*/
|
||||
void UnregisterNmeaMessageCallback();
|
||||
LocationErrCode UnregisterNmeaMessageCallback();
|
||||
|
||||
/**
|
||||
* @brief Unsubscribe satellite status changed.
|
||||
*/
|
||||
void UnregisterGnssStatusCallback();
|
||||
LocationErrCode UnregisterGnssStatusCallback();
|
||||
void ResetLocatorAgent(const wptr<IRemoteObject> &remote);
|
||||
private:
|
||||
class LocatorAgentDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
|
Loading…
Reference in New Issue
Block a user