1 /* 2 * Copyright (C) 2021 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 #ifndef CALL_BROADCAST_SUBSCRIBER_H 17 #define CALL_BROADCAST_SUBSCRIBER_H 18 19 #include <string> 20 #include <vector> 21 #include <map> 22 23 #include "common_event.h" 24 #include "common_event_manager.h" 25 #include "common_event_support.h" 26 27 namespace OHOS { 28 namespace Telephony { 29 class CallBroadcastSubscriber : public EventFwk::CommonEventSubscriber { 30 public: 31 explicit CallBroadcastSubscriber(const EventFwk::CommonEventSubscribeInfo &subscriberInfo); 32 ~CallBroadcastSubscriber() = default; 33 virtual void OnReceiveEvent(const EventFwk::CommonEventData &data); 34 35 private: 36 enum { 37 UNKNOWN_BROADCAST_EVENT = 0, 38 SIM_STATE_BROADCAST_EVENT, 39 }; 40 using broadcastSubscriberFunc = void (CallBroadcastSubscriber::*)(const EventFwk::CommonEventData &data); 41 42 void UnknownBroadcast(const EventFwk::CommonEventData &data); 43 void SimStateBroadcast(const EventFwk::CommonEventData &data); 44 std::map<uint32_t, broadcastSubscriberFunc> memberFuncMap_; 45 }; 46 } // namespace Telephony 47 } // namespace OHOS 48 49 #endif // CALL_BROADCAST_SUBSCRIBER_H 50