diff --git a/BUILD.gn b/BUILD.gn index 48a36aa7495848288d5880e6bbb01debf485825e..a4f299ebf883bb860073f5d873d0fe491cace4c4 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -40,7 +40,7 @@ ohos_shared_library("tel_state_registry") { "core_service:tel_core_service_api", "hiviewdfx_hilog_native:libhilog", "init:libbegetutil", - "ipc:ipc_core", + "ipc:ipc_single", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] diff --git a/bundle.json b/bundle.json index f399b8658beb53a43816134e25e32e429b6bc6e8..ec467b8b5b201ccedaa9212acc9ac18f191c3e88 100755 --- a/bundle.json +++ b/bundle.json @@ -65,15 +65,7 @@ { "type": "so", "header": { - "header_files": [ - "../../../../state_registry/interfaces/innerkits/observer/telephony_observer_client.h", - "i_telephony_state_notify.h", - "telephony_observer_broker.h", - "cell_information.h", - "network_state.h", - "signal_information.h", - "sim_state_type.h" - ], + "header_files": [], "header_base": "//base/telephony/core_service/interfaces/innerkits/include" }, "name": "//base/telephony/state_registry/frameworks/native/observer:tel_state_registry_api" diff --git a/frameworks/js/napi/BUILD.gn b/frameworks/js/napi/BUILD.gn index 106e49ff01388b191d44b77c79dcd3e914db54d7..765b4875652162f3c95cf9f909cd05e99bcf72bf 100644 --- a/frameworks/js/napi/BUILD.gn +++ b/frameworks/js/napi/BUILD.gn @@ -36,7 +36,7 @@ ohos_shared_library("observer") { "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "init:libbegetutil", - "ipc:ipc_core", + "ipc:ipc_single", "napi:ace_napi", "state_registry:tel_state_registry_api", ] diff --git a/frameworks/native/observer/BUILD.gn b/frameworks/native/observer/BUILD.gn index 005b27fedb4ff1ba6aab30366468ea6370a358d4..63c9cb5aa6d09d0e580e665aafcc19ffe8a7eaef 100644 --- a/frameworks/native/observer/BUILD.gn +++ b/frameworks/native/observer/BUILD.gn @@ -30,6 +30,10 @@ ohos_shared_library("tel_state_registry_api") { include_dirs = [ "$SUBSYSTEM_DIR/frameworks/native/observer/include" ] + innerapi_tags = [ "platformsdk" ] + + version_script = "$SUBSYSTEM_DIR/interfaces/innerkits/libtel_state_registry_api.versionscript" + public_configs = [ ":state_registry_observer_config" ] external_deps = [ @@ -37,7 +41,7 @@ ohos_shared_library("tel_state_registry_api") { "core_service:libtel_common", "core_service:tel_core_service_api", "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", + "ipc:ipc_single", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/libtel_state_registry_api.versionscript b/interfaces/innerkits/libtel_state_registry_api.versionscript new file mode 100644 index 0000000000000000000000000000000000000000..7ea4064b95b0035f214b84a0a003de0047c005c4 --- /dev/null +++ b/interfaces/innerkits/libtel_state_registry_api.versionscript @@ -0,0 +1,22 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +1.0 { + global: + extern "C++" { + *OHOS::Telephony::TelephonyObserver*; + *OHOS::Telephony::TelephonyStateManager*; + }; + local: + *; +}; diff --git a/interfaces/innerkits/observer/telephony_observer.h b/interfaces/innerkits/observer/telephony_observer.h index bd919a14c33807e038687ec59d372be450b0370c..a3e7eb12d136f6cb1003a9ec0921be85cdaa4339 100644 --- a/interfaces/innerkits/observer/telephony_observer.h +++ b/interfaces/innerkits/observer/telephony_observer.h @@ -30,21 +30,90 @@ class TelephonyObserver : public IRemoteStub { public: TelephonyObserver() {} ~TelephonyObserver() {} + + /** + * @brief Called when call state is updated. + * + * @param slotId Indicates the slot identification. + * @param callState Indicates the call state. + * @param phoneNumber Indicates the phoneNumber. + */ void OnCallStateUpdated( int32_t slotId, int32_t callState, const std::u16string &phoneNumber) override; + + /** + * @brief Called when signal info is updated. + * + * @param slotId Indicates the slot identification. + * @param vec Indicates the signal information lists. + */ void OnSignalInfoUpdated( int32_t slotId, const std::vector> &vec) override; + + /** + * @brief Called when network state is updated. + * + * @param slotId Indicates the slot identification. + * @param networkState Indicates the NetworkState. + */ void OnNetworkStateUpdated( int32_t slotId, const sptr &networkState) override; + + /** + * @brief Called when cell info is updated. + * + * @param slotId Indicates the slot identification. + * @param vec Indicates the cell information list. + */ void OnCellInfoUpdated( int32_t slotId, const std::vector> &vec) override; + + /** + * @brief Called when sim state is updated. + * + * @param slotId Indicates the slot identification. + * @param type Indicates the type of sim card. + * @param state Indicates the sim state. + * @param reason Indicates the sim lock reason. + */ void OnSimStateUpdated( int32_t slotId, CardType type, SimState state, LockReason reason) override; + + /** + * @brief Called when cellular data connect state is updated. + * + * @param slotId Indicates the slot identification. + * @param dataState Indicates the cellular data state. + * @param networkType Indicates the network type. + */ void OnCellularDataConnectStateUpdated( int32_t slotId, int32_t dataState, int32_t networkType) override; + + /** + * @brief Called when cellular data flow type is updated. + * + * @param slotId Indicates the slot identification. + * @param dataFlowType Indicates the data flow type. + */ void OnCellularDataFlowUpdated( int32_t slotId, int32_t dataFlowType) override; + + /** + * @brief Called when CFU(Call Forwarding Unconditional) indicator updated. + * + * @param slotId Indicates the slot identification. + * @param cfuResult Indicates whether support CFU, true if support, false if + * not. + */ virtual void OnCfuIndicatorUpdated(int32_t slotId, bool cfuResult) override; + + /** + * @brief Called when the voice mailbox state corresponding to the monitored slotId + * is updated. + * + * @param slotId Indicates the slot identification. + * @param voiceMailMsgResult + */ virtual void OnVoiceMailMsgIndicatorUpdated(int32_t slotId, bool voiceMailMsgResult) override; int32_t OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/innerkits/observer/telephony_observer_client.h b/interfaces/innerkits/observer/telephony_observer_client.h index d5ea7e02f1f6c14792a626814cf54348ac8babbb..0e52ce1f521f9e68c1c79ae9a563a4d437e10bca 100644 --- a/interfaces/innerkits/observer/telephony_observer_client.h +++ b/interfaces/innerkits/observer/telephony_observer_client.h @@ -28,9 +28,32 @@ class TelephonyObserverClient : public DelayedRefSingleton &telephonyObserver, int32_t slotId, uint32_t mask, bool isUpdate); + + /** + * @brief Remove state observer. + * + * @param slotId Indicates the slot identification. + * @param mask Indicates event type mask. + * @return Return 0 if remove successful, others if remove failed. + */ int32_t RemoveStateObserver(int32_t slotId, uint32_t mask); + + /** + * @brief Get the state registry proxy. + * + * @return Return the ITelephonyStateNotify interface. + */ sptr GetProxy(); private: diff --git a/test/unittest/state_test/BUILD.gn b/test/unittest/state_test/BUILD.gn index 337296fe03d9d0222b48cd101555ae9c50dcd3d0..5bba9db8aa4b3103d75fe740a561580c9cc7d737 100644 --- a/test/unittest/state_test/BUILD.gn +++ b/test/unittest/state_test/BUILD.gn @@ -39,7 +39,7 @@ ohos_unittest("tel_state_registry_test") { "core_service:libtel_common", "core_service:tel_core_service_api", "init:libbegetutil", - "ipc:ipc_core", + "ipc:ipc_single", "safwk:system_ability_fwk", "samgr:samgr_proxy", ]