1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #ifdef FEATURE_GNSS_SUPPORT
17 #include "gnss_common_event_subscriber.h"
18
19 #include "agnss_ni_manager.h"
20 #include "location_log.h"
21
22 namespace OHOS {
23 namespace Location {
OnReceiveEvent(const OHOS::EventFwk::CommonEventData & data)24 void GnssCommonEventSubscriber::OnReceiveEvent(const OHOS::EventFwk::CommonEventData &data)
25 {
26 LBSLOGD(GNSS, "OnReceiveEvent");
27 auto want = data.GetWant();
28 std::string action = want.GetAction();
29
30 auto agnssNiManager = AGnssNiManager::GetInstance();
31 if (action == CommonEventSupport::COMMON_EVENT_SMS_RECEIVE_COMPLETED) {
32 LBSLOGI(GNSS, "[AGNSS NI]:receive sms msg");
33 agnssNiManager->CheckSmsSuplInit(want);
34 } else if (action == CommonEventSupport::COMMON_EVENT_SMS_WAPPUSH_RECEIVE_COMPLETED) {
35 LBSLOGI(GNSS, "[AGNSS NI]:receive wap push msg");
36 agnssNiManager->CheckWapSuplInit(want);
37 } else if (action == CommonEventSupport::COMMON_EVENT_CALL_STATE_CHANGED) {
38 LBSLOGD(GNSS, "[AGNSS NI]:receive call state msg");
39 agnssNiManager->OnCallStateChanged(want);
40 } else if (action == AGNSS_NI_ACCEPT_EVENT) {
41 LBSLOGI(GNSS, "[AGNSS NI]:receive user accept event");
42 agnssNiManager->SendUserResponse(GNSS_NI_RESPONSE_CMD_ACCEPT);
43 } else if (action == AGNSS_NI_REJECT_EVENT) {
44 LBSLOGI(GNSS, "[AGNSS NI]:receive user reject event");
45 agnssNiManager->SendUserResponse(GNSS_NI_RESPONSE_CMD_REJECT);
46 }
47 }
48 } // namespace Location
49 } // namespace OHOS
50 #endif // FEATURE_GNSS_SUPPORT
51