mirror of
https://gitee.com/openharmony/telephony_core_service
synced 2024-11-22 23:50:24 +00:00
Signed-off-by: zhf <zhanghaifeng11@huawei.com>
This commit is contained in:
parent
387f476e74
commit
e904077611
15
.gitattributes
vendored
15
.gitattributes
vendored
@ -1,15 +0,0 @@
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.trp filter=lfs diff=lfs merge=lfs -text
|
||||
*.apk filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.asm filter=lfs diff=lfs merge=lfs -text
|
||||
*.8svn filter=lfs diff=lfs merge=lfs -text
|
||||
*.9svn filter=lfs diff=lfs merge=lfs -text
|
||||
*.dylib filter=lfs diff=lfs merge=lfs -text
|
||||
*.exe filter=lfs diff=lfs merge=lfs -text
|
||||
*.a filter=lfs diff=lfs merge=lfs -text
|
||||
*.so filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.dll filter=lfs diff=lfs merge=lfs -text
|
35
BUILD.gn
35
BUILD.gn
@ -21,18 +21,14 @@ TELEPHONY_SIM_ROOT = "//base/telephony/core_service/sim"
|
||||
ohos_shared_library("tel_core_service") {
|
||||
install_enable = true
|
||||
sources = [
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/interfaces/innerkits/proxy/network_search_callback_proxy.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/interfaces/innerkits/state_registry/proxy/telephony_state_registry_proxy.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/src/core.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/src/core_manager.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/src/core_service.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/src/core_service_stub.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/src/observer_handler.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/src/phone.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/services/src/phone_manager.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/hdf_death_recipient.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/hril_call_parcel.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/hril_data_parcel.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/hril_modem_parcel.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/hril_network_parcel.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/hril_sim_parcel.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/hril_sms_parcel.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/tel_ril_base.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/tel_ril_call.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/tel_ril_data.cpp",
|
||||
@ -41,28 +37,35 @@ ohos_shared_library("tel_core_service") {
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/tel_ril_network.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/tel_ril_sim.cpp",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/tel_ril/src/tel_ril_sms.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/network_information.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/network_register.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/network_search_handler.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/network_search_manager.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/network_search_notify.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/network_search_result.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/network_search_state.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/network_selection.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/network_state.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/operator_name.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/radio_info_state.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/radio_info.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/signal_info.cpp",
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/src/signal_information.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/icc_file.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/icc_file_controller.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/icc_state.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/mcc_pool.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/multi_sim_controller.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/plmn_file.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_file.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_file_controller.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_file_manager.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_manager.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_sms_controller.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_sms_manager.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_state_handle.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_state_manager.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_utils.cpp",
|
||||
"//base/telephony/core_service/interfaces/innerkits/state_registry/proxy/telephony_state_registry_proxy.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/usim_file_controller.cpp",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
@ -71,10 +74,15 @@ ohos_shared_library("tel_core_service") {
|
||||
"$TELEPHONY_NETWORK_SEARCH_ROOT/include",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/interfaces/innerkits/common",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/interfaces/innerkits/proxy",
|
||||
"//base/telephony/core_service/interfaces/innerkits/state_registry/proxy",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/interfaces/innerkits/state_registry/proxy",
|
||||
"$TELEPHONY_CORE_SERVICE_ROOT/common/log/include",
|
||||
"$TELEPHONY_SIM_ROOT/include",
|
||||
"//utils/native/base/include",
|
||||
"//utils/system/safwk/native/include",
|
||||
"//base/notification/ces_standard/cesfwk/kits/native/include",
|
||||
"//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include",
|
||||
"//foundation/aafwk/standard/interfaces/innerkits/want/include/ohos/aafwk/content/",
|
||||
]
|
||||
|
||||
defines = [
|
||||
@ -84,17 +92,20 @@ ohos_shared_library("tel_core_service") {
|
||||
|
||||
deps = [
|
||||
"$hdf_uhdf_path/hdi:libhdi",
|
||||
"//base/telephony/core_service/common:libtelephony_common",
|
||||
"//drivers/adapter/uhdf2/osal:libhdf_utils",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"aafwk_standard:ability_manager",
|
||||
"aafwk_standard:want",
|
||||
"appexecfwk_standard:libeventhandler",
|
||||
"ces_standard:cesfwk_innerkits",
|
||||
"ces_standard:cesfwk_core",
|
||||
"ces_standard:cesfwk_innerkits",
|
||||
"ces_standard:cesfwk_services",
|
||||
"ipc:ipc_core",
|
||||
"ril_adapter:hril",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr_L2:samgr_proxy",
|
||||
]
|
||||
|
352
LICENSE
352
LICENSE
@ -1,177 +1,177 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
147
README.md
Executable file → Normal file
147
README.md
Executable file → Normal file
@ -38,17 +38,33 @@ As shown in the preceding figure, the telephony core service consists of the SIM
|
||||
│ ├── innerkits # Internal APIs
|
||||
│ └── kits # External APIs (such as JS APIs)
|
||||
├── services # Implementation of the telephony core service
|
||||
│ ├── include
|
||||
│ └── src
|
||||
├── etc # Telephony core service driver scripts
|
||||
│ └── init
|
||||
├── sa_profile # SA profile
|
||||
├── tel_ril # RIL Manager service code
|
||||
│ ├── include
|
||||
│ ├── src
|
||||
│ └── test
|
||||
├── network_search # Network search service code
|
||||
│ ├── include
|
||||
│ ├── src
|
||||
│ └── test
|
||||
├── sim # SIM card service code
|
||||
└── common
|
||||
│ ├── include
|
||||
│ ├── src
|
||||
│ └── test
|
||||
├── common
|
||||
│ ├── log # Core service log print directory
|
||||
│ ├── preferences
|
||||
│ ├── utils
|
||||
│ └── test
|
||||
```
|
||||
|
||||
## Constraints<a name="section133mcpsimp"></a>
|
||||
|
||||
- Programming language: JavaScript
|
||||
- Programming language: C++、JavaScript
|
||||
- In terms of software, this module needs to work with the RIL adapter service \(ril\_adapter\) and status registration service \(state\_registry\).
|
||||
- In terms of hardware, the accommodating device must be equipped with a modem and a SIM card capable of independent cellular communication.
|
||||
|
||||
@ -59,6 +75,7 @@ The telephony core service module needs to provide APIs for related modules, inc
|
||||
### APIs for the SIM Card Service<a name="section142mcpsimp"></a>
|
||||
|
||||
<a name="table144mcpsimp"></a>
|
||||
|
||||
<table><thead align="left"><tr id="row150mcpsimp"><th class="cellrowborder" valign="top" width="33.406659334066596%" id="mcps1.1.4.1.1"><p id="entry151mcpsimpp0"><a name="entry151mcpsimpp0"></a><a name="entry151mcpsimpp0"></a>API</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="33.266673332666734%" id="mcps1.1.4.1.2"><p id="entry152mcpsimpp0"><a name="entry152mcpsimpp0"></a><a name="entry152mcpsimpp0"></a>Description</p>
|
||||
@ -67,37 +84,54 @@ The telephony core service module needs to provide APIs for related modules, inc
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row162mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p109592823314"><a name="p109592823314"></a><a name="p109592823314"></a>function getSimState(slotId: number, callback: AsyncCallback<SimState>): void;</p>
|
||||
<tbody><tr id="row162mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p109592823314"><a name="p109592823314"></a><a name="p109592823314"></a>function GetSimStatus(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry164mcpsimpp0"><a name="entry164mcpsimpp0"></a><a name="entry164mcpsimpp0"></a>Obtains the SIM card status.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry165mcpsimpp0"><a name="entry165mcpsimpp0"></a><a name="entry165mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row178mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="entry179mcpsimpp0"><a name="entry179mcpsimpp0"></a><a name="entry179mcpsimpp0"></a>function getISOCountryCodeForSim(slotId: number, callback: AsyncCallback<string>): void;</p>
|
||||
<tr id="row178mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="entry179mcpsimpp0"><a name="entry179mcpsimpp0"></a><a name="entry179mcpsimpp0"></a>function GetIsoCountryCode(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry180mcpsimpp0"><a name="entry180mcpsimpp0"></a><a name="entry180mcpsimpp0"></a>Obtains the country code.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry181mcpsimpp0"><a name="entry181mcpsimpp0"></a><a name="entry181mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row182mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1441115133518"><a name="p1441115133518"></a><a name="p1441115133518"></a>function getSimOperatorNumeric(slotId: number, callback: AsyncCallback<string>): void;</p>
|
||||
<tr id="row182mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1441115133518"><a name="p1441115133518"></a><a name="p1441115133518"></a>function GetSimOperator(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry184mcpsimpp0"><a name="entry184mcpsimpp0"></a><a name="entry184mcpsimpp0"></a>Obtains the carrier code.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry185mcpsimpp0"><a name="entry185mcpsimpp0"></a><a name="entry185mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row186mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1818291010352"><a name="p1818291010352"></a><a name="p1818291010352"></a>function getSimSpn(slotId: number, callback: AsyncCallback<string>): void;</p>
|
||||
<tr id="row186mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1818291010352"><a name="p1818291010352"></a><a name="p1818291010352"></a>function GetSpn(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry188mcpsimpp0"><a name="entry188mcpsimpp0"></a><a name="entry188mcpsimpp0"></a>Obtains the SPN information.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry189mcpsimpp0"><a name="entry189mcpsimpp0"></a><a name="entry189mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr id="row186mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1818291010352"><a name="p1818291010352"></a><a name="p1818291010352"></a>function SimStateUpdated(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry188mcpsimpp0"><a name="entry188mcpsimpp0"></a><a name="entry188mcpsimpp0"></a>SIM Card state update</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry189mcpsimpp0"><a name="entry189mcpsimpp0"></a><a name="entry189mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr id="row186mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1818291010352"><a name="p1818291010352"></a><a name="p1818291010352"></a>function UnlockSimPin(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry188mcpsimpp0"><a name="entry188mcpsimpp0"></a><a name="entry188mcpsimpp0"></a>Unlock SIM Card</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry189mcpsimpp0"><a name="entry189mcpsimpp0"></a><a name="entry189mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
### APIs for the Network Search Service<a name="section198mcpsimp"></a>
|
||||
|
||||
<a name="table200mcpsimp"></a>
|
||||
@ -109,27 +143,106 @@ The telephony core service module needs to provide APIs for related modules, inc
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row210mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p611934143612"><a name="p611934143612"></a><a name="p611934143612"></a>function getRadioTech(slotId: number, callback: AsyncCallback<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>): void;</p>
|
||||
<tbody><tr id="row210mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p611934143612"><a name="p611934143612"></a><a name="p611934143612"></a>function GetPsRadioTech(int32_t slotId): void;</p>function GetCsRadioTech(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry212mcpsimpp0"><a name="entry212mcpsimpp0"></a><a name="entry212mcpsimpp0"></a>Obtains the current radio access technology.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry213mcpsimpp0"><a name="entry213mcpsimpp0"></a><a name="entry213mcpsimpp0"></a>ohos.permission.GET_NETWORK_INFO</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function getSignalInformation(slotId: number, callback: AsyncCallback<Array<SignalInformation>>): void;</p>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function GetSignalInfoList(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Obtains the signal information.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row230mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p22372373611"><a name="p22372373611"></a><a name="p22372373611"></a>function getNetworkState(slotId: number, callback: AsyncCallback<NetworkState>): void;</p>
|
||||
<tr id="row230mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p22372373611"><a name="p22372373611"></a><a name="p22372373611"></a>function GetNetworkStatus(slotId: number, callback: AsyncCallback<GetNetworkStatus>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry232mcpsimpp0"><a name="entry232mcpsimpp0"></a><a name="entry232mcpsimpp0"></a>Obtains the network status.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry233mcpsimpp0"><a name="entry233mcpsimpp0"></a><a name="entry233mcpsimpp0"></a>ohos.permission.GET_NETWORK_INFO</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function getNetworkSelectionMode(slotId: number, callback: AsyncCallback<NetworkSelectionMode>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Obtains the current network mode.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function setNetworkSelectionMode(options: NetworkSelectionModeOptions, callback: AsyncCallback<boolean>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Set the current network mode.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function getNetworkSearchInformation(slotId: number, callback: AsyncCallback<NetworkSearchResult>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Obtains the results of manual networksearch.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function isRadioOn(slotId: number, callback: AsyncCallback<boolean>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Determine that the radio is on.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function turnOnRadio(callback: AsyncCallback<void>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Open the radio.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function turnOffRadio(callback: AsyncCallback<void>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Close the radio.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function getISOCountryCodeForNetwork(slotId: number, callback: AsyncCallback<string>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Obtains the ISOCountryCode.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function setPreferredNetworkPara(slotId: number, networkMode: NetworkMode, callback: AsyncCallback<boolean>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Set the Preferred Network Mode.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function getPreferredNetworkPara(slotId: number, callback: AsyncCallback<NetworkMode>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Obtains the Preferred Network Mode.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function GetSignalStrength(slotId: number, callback: AsyncCallback<NetworkMode>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Get signal strength </p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function GetOperatorInfo(slotId: number, callback: AsyncCallback<NetworkMode>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>Get operator information </p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -143,8 +256,8 @@ The telephony core service module needs to provide APIs for related modules, inc
|
||||
The function of obtaining the network status is used as an example. The process is as follows:
|
||||
|
||||
1. Query the SIM card in the slot specified by **slotId**. If **slotId** is not set, information about the primary card is queried by default.
|
||||
2. Call the **getNetworkState** method in callback or Promise mode.
|
||||
3. Obtain the network status information. The **getNetworkState** method works in asynchronous mode. The execution result is returned through the callback.
|
||||
2. Call the **GetNetworkStatus** method in callback or Promise mode.
|
||||
3. Obtain the network status information. The **GetNetworkStatus** method works in asynchronous mode. The execution result is returned through the callback.
|
||||
|
||||
```
|
||||
import radio from "@ohos.telephony.radio";
|
||||
@ -153,24 +266,24 @@ The function of obtaining the network status is used as an example. The process
|
||||
let slotId = 1;
|
||||
|
||||
// Call the API in callback mode.
|
||||
radio.getNetworkState(slotId, (err, value) => {
|
||||
radio.GetNetworkStatus(slotId, (err, value) => {
|
||||
if (err) {
|
||||
// If the API call failed, err is not empty.
|
||||
console.error(`failed to getNetworkState because ${err.message}`);
|
||||
console.error(`failed to GetNetworkStatus because ${err.message}`);
|
||||
return;
|
||||
}
|
||||
// If the API call succeeded, err is empty.
|
||||
console.log(`success to getNetworkState: ${value}`);
|
||||
console.log(`success to GetNetworkStatus: ${value}`);
|
||||
});
|
||||
|
||||
// Call the API in Promise mode.
|
||||
let promise = radio.getNetworkState(slotId);
|
||||
let promise = radio.GetNetworkStatus(slotId);
|
||||
promise.then((value) => {
|
||||
// The API call succeeded.
|
||||
console.log(`success to getNetworkState: ${value}`);
|
||||
console.log(`success to GetNetworkStatus: ${value}`);
|
||||
}).catch((err) => {
|
||||
// The API call failed.
|
||||
console.error(`failed to getNetworkState because ${err.message}`);
|
||||
console.error(`failed to GetNetworkStatus because ${err.message}`);
|
||||
});
|
||||
```
|
||||
|
||||
|
180
README_zh.md
Executable file → Normal file
180
README_zh.md
Executable file → Normal file
@ -38,17 +38,33 @@
|
||||
│ ├── innerkits # 部件间的内部接口
|
||||
│ └── kits # 对应用提供的接口(例如JS接口)
|
||||
├── services # 核心服务实现代码目录
|
||||
│ ├── include
|
||||
│ └── src
|
||||
├── etc # 核心服务的驱动脚本目录
|
||||
│ └── init
|
||||
├── sa_profile # 核心服务的启动文件目录
|
||||
├── tel_ril # 核心服务与RIL Adapter通信代码目录
|
||||
│ ├── include
|
||||
│ ├── src
|
||||
│ └── test
|
||||
├── network_search # 搜网服务代码目录
|
||||
│ ├── include
|
||||
│ ├── src
|
||||
│ └── test
|
||||
├── sim # SIM卡服务代码目录
|
||||
└── common
|
||||
│ ├── include
|
||||
│ ├── src
|
||||
│ └── test
|
||||
├── common
|
||||
│ ├── log # 核心服务日志打印目录
|
||||
│ ├── preferences
|
||||
│ ├── utils
|
||||
│ ├── test
|
||||
```
|
||||
|
||||
## 约束<a name="section133mcpsimp"></a>
|
||||
|
||||
- 开发语言:Java Script。
|
||||
- 开发语言:C++ 、Java Script。
|
||||
- 软件上,需要与以下服务配合使用:RIL适配(ril\_adapter),状态注册服务(state\_registry)。
|
||||
- 硬件上,需要搭载的设备支持以下硬件:可以进行独立蜂窝通信的Modem以及SIM卡。
|
||||
|
||||
@ -59,48 +75,68 @@
|
||||
### 获取SIM卡信息相关接口<a name="section142mcpsimp"></a>
|
||||
|
||||
<a name="table144mcpsimp"></a>
|
||||
<table><thead align="left"><tr id="row150mcpsimp"><th class="cellrowborder" valign="top" width="33.406659334066596%" id="mcps1.1.4.1.1"><p id="entry151mcpsimpp0"><a name="entry151mcpsimpp0"></a><a name="entry151mcpsimpp0"></a>接口名称</p>
|
||||
|
||||
<table><thead align="left"><tr id="row150mcpsimp"><th class="cellrowborder" valign="top" width="33.406659334066596%" id="mcps1.1.4.1.1"><p id="entry151mcpsimpp0"><a name="entry151mcpsimpp0"></a><a name="entry151mcpsimpp0"></a>API</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="33.266673332666734%" id="mcps1.1.4.1.2"><p id="entry152mcpsimpp0"><a name="entry152mcpsimpp0"></a><a name="entry152mcpsimpp0"></a>接口描述</p>
|
||||
<th class="cellrowborder" valign="top" width="33.266673332666734%" id="mcps1.1.4.1.2"><p id="entry152mcpsimpp0"><a name="entry152mcpsimpp0"></a><a name="entry152mcpsimpp0"></a>Description</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="33.32666733326668%" id="mcps1.1.4.1.3"><p id="entry153mcpsimpp0"><a name="entry153mcpsimpp0"></a><a name="entry153mcpsimpp0"></a>所需权限</p>
|
||||
<th class="cellrowborder" valign="top" width="33.32666733326668%" id="mcps1.1.4.1.3"><p id="entry153mcpsimpp0"><a name="entry153mcpsimpp0"></a><a name="entry153mcpsimpp0"></a>Required Permission</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row162mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p109592823314"><a name="p109592823314"></a><a name="p109592823314"></a>function getSimState(slotId: number, callback: AsyncCallback<SimState>): void;</p>
|
||||
<tbody><tr id="row162mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p109592823314"><a name="p109592823314"></a><a name="p109592823314"></a>function GetSimStatus(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry164mcpsimpp0"><a name="entry164mcpsimpp0"></a><a name="entry164mcpsimpp0"></a>获取卡状态</p>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry164mcpsimpp0"><a name="entry164mcpsimpp0"></a><a name="entry164mcpsimpp0"></a>Obtains the SIM card status.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry165mcpsimpp0"><a name="entry165mcpsimpp0"></a><a name="entry165mcpsimpp0"></a>无</p>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry165mcpsimpp0"><a name="entry165mcpsimpp0"></a><a name="entry165mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row178mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="entry179mcpsimpp0"><a name="entry179mcpsimpp0"></a><a name="entry179mcpsimpp0"></a>function getISOCountryCodeForSim(slotId: number, callback: AsyncCallback<string>): void;</p>
|
||||
<tr id="row178mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="entry179mcpsimpp0"><a name="entry179mcpsimpp0"></a><a name="entry179mcpsimpp0"></a>function GetIsoCountryCode(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry180mcpsimpp0"><a name="entry180mcpsimpp0"></a><a name="entry180mcpsimpp0"></a>获取国家码</p>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry180mcpsimpp0"><a name="entry180mcpsimpp0"></a><a name="entry180mcpsimpp0"></a>Obtains the country code.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry181mcpsimpp0"><a name="entry181mcpsimpp0"></a><a name="entry181mcpsimpp0"></a>无</p>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry181mcpsimpp0"><a name="entry181mcpsimpp0"></a><a name="entry181mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row182mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1441115133518"><a name="p1441115133518"></a><a name="p1441115133518"></a>function getSimOperatorNumeric(slotId: number, callback: AsyncCallback<string>): void;</p>
|
||||
<tr id="row182mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1441115133518"><a name="p1441115133518"></a><a name="p1441115133518"></a>function GetSimOperator(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry184mcpsimpp0"><a name="entry184mcpsimpp0"></a><a name="entry184mcpsimpp0"></a>获取运营商数字码</p>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry184mcpsimpp0"><a name="entry184mcpsimpp0"></a><a name="entry184mcpsimpp0"></a>Obtains the carrier code.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry185mcpsimpp0"><a name="entry185mcpsimpp0"></a><a name="entry185mcpsimpp0"></a>无</p>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry185mcpsimpp0"><a name="entry185mcpsimpp0"></a><a name="entry185mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row186mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1818291010352"><a name="p1818291010352"></a><a name="p1818291010352"></a>function getSimSpn(slotId: number, callback: AsyncCallback<string>): void;</p>
|
||||
<tr id="row186mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1818291010352"><a name="p1818291010352"></a><a name="p1818291010352"></a>function GetSpn(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry188mcpsimpp0"><a name="entry188mcpsimpp0"></a><a name="entry188mcpsimpp0"></a>获取SPN信息</p>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry188mcpsimpp0"><a name="entry188mcpsimpp0"></a><a name="entry188mcpsimpp0"></a>Obtains the SPN information.</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry189mcpsimpp0"><a name="entry189mcpsimpp0"></a><a name="entry189mcpsimpp0"></a>无</p>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry189mcpsimpp0"><a name="entry189mcpsimpp0"></a><a name="entry189mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr id="row186mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1818291010352"><a name="p1818291010352"></a><a name="p1818291010352"></a>function SimStateUpdated(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry188mcpsimpp0"><a name="entry188mcpsimpp0"></a><a name="entry188mcpsimpp0"></a>SIM Card state update</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry189mcpsimpp0"><a name="entry189mcpsimpp0"></a><a name="entry189mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr id="row186mcpsimp"><td class="cellrowborder" valign="top" width="33.406659334066596%" headers="mcps1.1.4.1.1 "><p id="p1818291010352"><a name="p1818291010352"></a><a name="p1818291010352"></a>function UnlockSimPin(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.266673332666734%" headers="mcps1.1.4.1.2 "><p id="entry188mcpsimpp0"><a name="entry188mcpsimpp0"></a><a name="entry188mcpsimpp0"></a>Unlock SIM Card</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.32666733326668%" headers="mcps1.1.4.1.3 "><p id="entry189mcpsimpp0"><a name="entry189mcpsimpp0"></a><a name="entry189mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
### 搜网服务相关接口<a name="section198mcpsimp"></a>
|
||||
|
||||
<a name="table200mcpsimp"></a>
|
||||
|
||||
<table><thead align="left"><tr id="row206mcpsimp"><th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.1.4.1.1"><p id="entry207mcpsimpp0"><a name="entry207mcpsimpp0"></a><a name="entry207mcpsimpp0"></a>接口名称</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.1.4.1.2"><p id="entry208mcpsimpp0"><a name="entry208mcpsimpp0"></a><a name="entry208mcpsimpp0"></a>接口描述</p>
|
||||
@ -109,27 +145,105 @@
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row210mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p611934143612"><a name="p611934143612"></a><a name="p611934143612"></a>function getRadioTech(slotId: number, callback: AsyncCallback<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>): void;</p>
|
||||
<tbody><tr id="row210mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p611934143612"><a name="p611934143612"></a><a name="p611934143612"></a>function GetPsRadioTech(int32_t slotId): void;</p>function GetCsRadioTech(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry212mcpsimpp0"><a name="entry212mcpsimpp0"></a><a name="entry212mcpsimpp0"></a>获取当前接入技术</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry213mcpsimpp0"><a name="entry213mcpsimpp0"></a><a name="entry213mcpsimpp0"></a>ohos.permission.GET_NETWORK_INFO</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function getSignalInformation(slotId: number, callback: AsyncCallback<Array<SignalInformation>>): void;</p>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function GetSignalInfoList(int32_t slotId): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>获取信号列表</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>无</p>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row230mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p22372373611"><a name="p22372373611"></a><a name="p22372373611"></a>function getNetworkState(slotId: number, callback: AsyncCallback<NetworkState>): void;</p>
|
||||
<tr id="row230mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p22372373611"><a name="p22372373611"></a><a name="p22372373611"></a>function GetNetworkStatus(slotId: number, callback: AsyncCallback<GetNetworkStatus>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry232mcpsimpp0"><a name="entry232mcpsimpp0"></a><a name="entry232mcpsimpp0"></a>获取网络状态</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry233mcpsimpp0"><a name="entry233mcpsimpp0"></a><a name="entry233mcpsimpp0"></a>ohos.permission.GET_NETWORK_INFO</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function GetNetworkSelectionMode(slotId: number, callback: AsyncCallback<NetworkSelectionMode>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>获取当前选网模式</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function SetNetworkSelectionMode(options: NetworkSelectionModeOptions, callback: AsyncCallback<boolean>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>设置当前选网模式</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function GetNetworkSearchInformation(slotId: number, callback: AsyncCallback<NetworkSearchResult>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>获得手动搜网的结果</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function IsRadioOn(slotId: number, callback: AsyncCallback<boolean>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>判断radio是否为开</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function TurnOnRadio(callback: AsyncCallback<void>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>打开radio</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function TurnOffRadio(callback: AsyncCallback<void>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>关闭radio</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function GetISOCountryCodeForNetwork(slotId: number, callback: AsyncCallback<string>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>获得国家码</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function SetPreferredNetworkPara(slotId: number, networkMode: NetworkMode, callback: AsyncCallback<boolean>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>设置优选网络模式</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function GetPreferredNetworkPara(slotId: number, callback: AsyncCallback<NetworkMode>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>获取优选网络模式</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function GetSignalStrength(slotId: number, callback: AsyncCallback<NetworkMode>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>获取信号强度</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr id="row226mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.1 "><p id="p924781783614"><a name="p924781783614"></a><a name="p924781783614"></a>function GetOperatorInfo(slotId: number, callback: AsyncCallback<NetworkMode>): void;</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.2 "><p id="entry228mcpsimpp0"><a name="entry228mcpsimpp0"></a><a name="entry228mcpsimpp0"></a>获取运营商信息</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="entry229mcpsimpp0"><a name="entry229mcpsimpp0"></a><a name="entry229mcpsimpp0"></a>None</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -143,7 +257,7 @@
|
||||
以获取网络状态为例,相关流程如下:
|
||||
|
||||
1. 指定查询的slotId,若不指定默认查询主卡信息。
|
||||
2. 可以通过callback或者Promise的方式调用getNetworkState方法,返回网络状态信息。
|
||||
2. 可以通过callback或者Promise的方式调用GetNetworkStatus方法,返回网络状态信息。
|
||||
3. 该接口为异步接口,相关执行结果会从callback中返回。
|
||||
|
||||
```
|
||||
@ -153,24 +267,24 @@
|
||||
let slotId = 1;
|
||||
|
||||
// 调用接口【callback方式】
|
||||
radio.getNetworkState(slotId, (err, value) => {
|
||||
radio.GetNetworkStatus(slotId, (err, value) => {
|
||||
if (err) {
|
||||
// 接口调用失败,err非空
|
||||
console.error(`failed to getNetworkState because ${err.message}`);
|
||||
console.error(`failed to GetNetworkStatus because ${err.message}`);
|
||||
return;
|
||||
}
|
||||
// 接口调用成功,err为空
|
||||
console.log(`success to getNetworkState: ${value}`);
|
||||
console.log(`success to GetNetworkStatus: ${value}`);
|
||||
});
|
||||
|
||||
// 调用接口【Promise方式】
|
||||
let promise = radio.getNetworkState(slotId);
|
||||
let promise = radio.GetNetworkStatus(slotId);
|
||||
promise.then((value) => {
|
||||
// 接口调用成功,此处可以实现成功场景分支代码。
|
||||
console.log(`success to getNetworkState: ${value}`);
|
||||
console.log(`success to GetNetworkStatus: ${value}`);
|
||||
}).catch((err) => {
|
||||
// 接口调用失败,此处可以实现失败场景分支代码。
|
||||
console.error(`failed to getNetworkState because ${err.message}`);
|
||||
console.error(`failed to GetNetworkStatus because ${err.message}`);
|
||||
});
|
||||
```
|
||||
|
||||
@ -190,24 +304,24 @@
|
||||
let slotId = 1;
|
||||
|
||||
// 调用接口【callback方式】
|
||||
sim.getSimState(slotId, (err, value) => {
|
||||
sim.GetNetworkStatus(slotId, (err, value) => {
|
||||
if (err) {
|
||||
// 接口调用失败,err非空
|
||||
console.error(`failed to getSimState because ${err.message}`);
|
||||
console.error(`failed to GetNetworkStatus because ${err.message}`);
|
||||
return;
|
||||
}
|
||||
// 接口调用成功,err为空
|
||||
console.log(`success to getSimState: ${value}`);
|
||||
console.log(`success to GetNetworkStatus: ${value}`);
|
||||
});
|
||||
|
||||
// 调用接口【Promise方式】
|
||||
let promise = sim.getSimState(slotId);
|
||||
let promise = sim.GetNetworkStatus(slotId);
|
||||
promise.then((value) => {
|
||||
// 接口调用成功,此处可以实现成功场景分支代码。
|
||||
console.log(`success to getSimState: ${value}`);
|
||||
}).catch((err) => {
|
||||
// 接口调用失败,此处可以实现失败场景分支代码。
|
||||
console.error(`failed to getSimState because ${err.message}`);
|
||||
console.error(`failed to GetNetworkStatus because ${err.message}`);
|
||||
});
|
||||
```
|
||||
|
||||
|
3
common/BUILD.gn
Executable file → Normal file
3
common/BUILD.gn
Executable file → Normal file
@ -36,6 +36,7 @@ ohos_shared_library("libtelephony_common") {
|
||||
"TELEPHONY_LOG_TAG = \"TELEPHONY_COMMON\"",
|
||||
"LOG_DOMAIN = 0xD002B01",
|
||||
]
|
||||
|
||||
if (is_standard_system) {
|
||||
defines += [ "STANDARD_SYSTEM_ENABLE" ]
|
||||
}
|
||||
@ -60,6 +61,8 @@ ohos_shared_library("libtelephony_common") {
|
||||
external_deps = [ "hilog:libhilog" ]
|
||||
}
|
||||
|
||||
external_deps += [ "native_appdatamgr:native_preferences" ]
|
||||
|
||||
part_name = "core_service"
|
||||
subsystem_name = "telephony"
|
||||
}
|
||||
|
58
common/log/include/telephony_log_c.h
Normal file
58
common/log/include/telephony_log_c.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef TELEPHONY_LOG_C_H
|
||||
#define TELEPHONY_LOG_C_H
|
||||
|
||||
#include "hilog/log.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef LOG_DOMAIN
|
||||
#define LOG_DOMAIN 0xD002B01
|
||||
#endif
|
||||
#ifndef LOG_TAG
|
||||
#define LOG_TAG "TelephonySubsystem"
|
||||
#endif
|
||||
|
||||
#define __TEL_FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
#define OHOS_DEBUG
|
||||
#ifndef OHOS_DEBUG
|
||||
#define DECORATOR_HILOG(op, fmt, args...) \
|
||||
do { \
|
||||
op(LOG_CORE, fmt, ##args); \
|
||||
} while (0)
|
||||
#else
|
||||
#define DECORATOR_HILOG(op, fmt, args...) \
|
||||
do { \
|
||||
op(LOG_CORE, "[%{public}s-(%{public}s:%{public}d)] " fmt, __FUNCTION__, __TEL_FILENAME__, __LINE__, \
|
||||
##args); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define TELEPHONY_LOGD(fmt, args...) DECORATOR_HILOG(HILOG_DEBUG, fmt, ##args)
|
||||
#define TELEPHONY_LOGE(fmt, args...) DECORATOR_HILOG(HILOG_ERROR, fmt, ##args)
|
||||
#define TELEPHONY_LOGW(fmt, args...) DECORATOR_HILOG(HILOG_WARN, fmt, ##args)
|
||||
#define TELEPHONY_LOGI(fmt, args...) DECORATOR_HILOG(HILOG_INFO, fmt, ##args)
|
||||
#define TELEPHONY_LOGF(fmt, args...) DECORATOR_HILOG(HILOG_FATAL, fmt, ##args)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TELEPHONY_LOG_C_H
|
43
common/log/include/telephony_log_wrapper.h
Executable file → Normal file
43
common/log/include/telephony_log_wrapper.h
Executable file → Normal file
@ -16,10 +16,11 @@
|
||||
#ifndef OHOS_TELEPHONY_LOG_WRAPPER_H
|
||||
#define OHOS_TELEPHONY_LOG_WRAPPER_H
|
||||
|
||||
#include "hilog/log.h"
|
||||
#include <string>
|
||||
#include "hilog/log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
enum class TelephonyLogLevel {
|
||||
DEBUG = 0,
|
||||
INFO,
|
||||
@ -28,8 +29,6 @@ enum class TelephonyLogLevel {
|
||||
FATAL,
|
||||
};
|
||||
|
||||
static constexpr OHOS::HiviewDFX::HiLogLabel TELEPHONY_LABEL = {LOG_CORE, LOG_DOMAIN, TELEPHONY_LOG_TAG};
|
||||
|
||||
class TelephonyLogWrapper {
|
||||
public:
|
||||
static bool JudgeLevel(const TelephonyLogLevel &level);
|
||||
@ -50,15 +49,35 @@ private:
|
||||
static TelephonyLogLevel level_;
|
||||
};
|
||||
|
||||
#define PRINT_LOG(LEVEL, Level, fmt, ...) \
|
||||
if (TelephonyLogWrapper::JudgeLevel(TelephonyLogLevel::LEVEL)) \
|
||||
OHOS::HiviewDFX::HiLog::Level(TELEPHONY_LABEL, "[%{public}s(%{public}s)] " fmt, \
|
||||
TelephonyLogWrapper::GetBriefFileName(std::string(__FILE__)).c_str(), __FUNCTION__, ##__VA_ARGS__)
|
||||
#define CONFIG_HILOG
|
||||
#ifdef CONFIG_HILOG
|
||||
|
||||
#define TELEPHONY_LOGD(fmt, ...) PRINT_LOG(DEBUG, Debug, fmt, ##__VA_ARGS__)
|
||||
#define TELEPHONY_LOGI(fmt, ...) PRINT_LOG(INFO, Info, fmt, ##__VA_ARGS__)
|
||||
#define TELEPHONY_LOGW(fmt, ...) PRINT_LOG(WARN, Warn, fmt, ##__VA_ARGS__)
|
||||
#define TELEPHONY_LOGE(fmt, ...) PRINT_LOG(ERROR, Error, fmt, ##__VA_ARGS__)
|
||||
#define TELEPHONY_LOGF(fmt, ...) PRINT_LOG(FATAL, Fatal, fmt, ##__VA_ARGS__)
|
||||
#ifndef TELEPHONY_LOG_TAG
|
||||
#define TELEPHONY_LOG_TAG "TelephonySubsystem"
|
||||
#endif
|
||||
|
||||
static constexpr OHOS::HiviewDFX::HiLogLabel TELEPHONY_LABEL = {LOG_CORE, LOG_DOMAIN, TELEPHONY_LOG_TAG};
|
||||
|
||||
#define __TEL_FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
#define OHOS_DEBUG
|
||||
#ifndef OHOS_DEBUG
|
||||
#define PRINT_LOG(op, fmt, ...) (void)OHOS::HiviewDFX::HiLog::op(TELEPHONY_LABEL, fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define PRINT_LOG(op, fmt, ...) \
|
||||
(void)OHOS::HiviewDFX::HiLog::op(TELEPHONY_LABEL, "[%{public}s-(%{public}s:%{public}d)] " fmt, __FUNCTION__, \
|
||||
__TEL_FILENAME__, __LINE__, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define TELEPHONY_LOGD(fmt, ...) PRINT_LOG(Debug, fmt, ##__VA_ARGS__)
|
||||
#define TELEPHONY_LOGE(fmt, ...) PRINT_LOG(Error, fmt, ##__VA_ARGS__)
|
||||
#define TELEPHONY_LOGW(fmt, ...) PRINT_LOG(Warn, fmt, ##__VA_ARGS__)
|
||||
#define TELEPHONY_LOGI(fmt, ...) PRINT_LOG(Info, fmt, ##__VA_ARGS__)
|
||||
#define TELEPHONY_LOGF(fmt, ...) PRINT_LOG(Fatal, fmt, ##__VA_ARGS__)
|
||||
|
||||
#else
|
||||
#define TELEPHONY_LOGD(...)
|
||||
#endif // CONFIG_HILOG
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_TELEPHONY_LOG_WRAPPER_H
|
@ -14,9 +14,9 @@
|
||||
*/
|
||||
|
||||
#include "telephony_log_wrapper.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
// initial static member object
|
||||
TelephonyLogLevel TelephonyLogWrapper::level_ = TelephonyLogLevel::DEBUG;
|
||||
|
||||
@ -43,4 +43,5 @@ std::string TelephonyLogWrapper::GetBriefFileName(const std::string &file)
|
||||
|
||||
return file;
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -16,18 +16,16 @@
|
||||
#ifndef DATA_STORAGE_PREFERENCES_UTILS_H
|
||||
#define DATA_STORAGE_PREFERENCES_UTILS_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "singleton.h"
|
||||
|
||||
#include "preferences.h"
|
||||
#include "preferences_errno.h"
|
||||
#include "preferences_observer.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCommon {
|
||||
namespace Telephony {
|
||||
class TelProfileUtil {
|
||||
DECLARE_DELAYED_SINGLETON(TelProfileUtil);
|
||||
|
||||
@ -59,6 +57,6 @@ private:
|
||||
int errCode_ = NativePreferences::E_OK;
|
||||
const std::string error_ = "error";
|
||||
};
|
||||
} // namespace TelephonyCommon
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // DATA_STORAGE_PREFERENCES_UTILS_H
|
@ -12,11 +12,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "tel_profile_util.h"
|
||||
#include "preferences_helper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCommon {
|
||||
namespace Telephony {
|
||||
TelProfileUtil::TelProfileUtil() {}
|
||||
TelProfileUtil::~TelProfileUtil() {}
|
||||
|
||||
@ -179,5 +180,5 @@ void TelProfileUtil::UnRegisterObserver(std::shared_ptr<NativePreferences::Prefe
|
||||
ptr->UnRegisterObserver(preferencesObserver);
|
||||
}
|
||||
}
|
||||
} // namespace TelephonyCommon
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -1,48 +0,0 @@
|
||||
# Copyright (c) 2021 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.
|
||||
import("//build/ohos.gni")
|
||||
import("//build/test.gni")
|
||||
|
||||
module_output_path = "//base/telephony/core_service/common/telephonydfx"
|
||||
|
||||
ohos_unittest("TelephonySAPreferencesTest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
sources = [ "//base/telephony/core_service/common/preferences/src/preferences_utils.cpp" ]
|
||||
|
||||
sources += [ "telephony_preferences_test.cpp" ]
|
||||
|
||||
configs = [
|
||||
"//base/telephony/core_service/common:telephony_common_config",
|
||||
"//base/telephony/core_service/common/test:common_test_config",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_preferences:native_preferences",
|
||||
"//third_party/googletest:gtest_main",
|
||||
]
|
||||
|
||||
if (is_standard_system) {
|
||||
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
|
||||
} else {
|
||||
external_deps = [ "hilog:libhilog" ]
|
||||
}
|
||||
|
||||
part_name = "core_service"
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
testonly = true
|
||||
|
||||
deps = [ ":TelephonySAPreferencesTest" ]
|
||||
}
|
@ -17,17 +17,15 @@
|
||||
#define STR_CONVERT_H
|
||||
|
||||
#include <codecvt>
|
||||
#include <cstdio>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularData {
|
||||
namespace Telephony {
|
||||
std::u16string ToUtf16(std::string str);
|
||||
std::string ToUtf8(std::u16string str16);
|
||||
std::u32string ToUtf32(std::string str);
|
||||
std::string ToUtf8(std::u32string str32);
|
||||
std::string ToUtf8(std::wstring wstr);
|
||||
} // namespace CellularData
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // STR_CONVERT_H
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "str_convert.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularData {
|
||||
namespace Telephony {
|
||||
std::u16string ToUtf16(std::string str)
|
||||
{
|
||||
return std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> {}.from_bytes(str);
|
||||
@ -41,5 +41,5 @@ std::string ToUtf8(std::wstring wstr)
|
||||
{
|
||||
return std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> {}.to_bytes(wstr);
|
||||
}
|
||||
} // namespace CellularData
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -14,7 +14,12 @@ import("//build/ohos.gni")
|
||||
|
||||
## Install telephony.rc to /system/etc/init/telephony.rc
|
||||
ohos_prebuilt_etc("telephony.rc") {
|
||||
source = "telephony.rc"
|
||||
if (use_musl) {
|
||||
source = "telephony.cfg"
|
||||
} else {
|
||||
source = "telephony.rc"
|
||||
}
|
||||
|
||||
relative_install_dir = "init"
|
||||
part_name = "core_service"
|
||||
subsystem_name = "telephony"
|
||||
|
17
etc/init/telephony.cfg
Normal file
17
etc/init/telephony.cfg
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"jobs" : [{
|
||||
"name" : "boot",
|
||||
"cmds" : [
|
||||
"exec /system/bin/sleep 4",
|
||||
"start telephony_sa"
|
||||
]
|
||||
}
|
||||
],
|
||||
"services" : [{
|
||||
"name" : "telephony_sa",
|
||||
"path" : ["/system/bin/sa_main", "/system/profile/telephony.xml"],
|
||||
"uid" : "system",
|
||||
"gid" : ["system", "shell"]
|
||||
}
|
||||
]
|
||||
}
|
36
interfaces/innerkits/common/hril_notification.h → interfaces/innerkits/api/base_context.h
Executable file → Normal file
36
interfaces/innerkits/common/hril_notification.h → interfaces/innerkits/api/base_context.h
Executable file → Normal file
@ -12,27 +12,21 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef OHOS_RIL_NOTIFICATION_H
|
||||
#define OHOS_RIL_NOTIFICATION_H
|
||||
typedef enum {
|
||||
HNOTI_CALL_BASE = 1000,
|
||||
HNOTI_CALL_STATE_UPDATED,
|
||||
|
||||
HNOTI_SMS_BASE = 1100,
|
||||
HNOTI_SMS_NEW_SMS,
|
||||
HNOTI_SMS_STATUS_REPORT,
|
||||
HNOTI_SMS_NEW_SMS_STORED_ON_SIM,
|
||||
#ifndef BASE_TELEPHONY_NAPI_BASE_CONTEXT_H
|
||||
#define BASE_TELEPHONY_NAPI_BASE_CONTEXT_H
|
||||
|
||||
HNOTI_SIM_BASE = 1200,
|
||||
#include "napi/native_api.h"
|
||||
#include "napi/native_node_api.h"
|
||||
|
||||
HNOTI_DATA_BASE = 1300,
|
||||
HNOTI_DATA_PDP_CONTEXT_LIST_UPDATED,
|
||||
|
||||
HNOTI_NETWORK_BASE = 1400,
|
||||
HNOTI_NETWORK_CS_REG_STATUS_UPDATED,
|
||||
HNOTI_NETWORK_SIGNAL_STRENGTH_UPDATED,
|
||||
|
||||
HNOTI_COMMON_BASE = 1500,
|
||||
HNOTI_MODEM_RADIO_STATE_UPDATED,
|
||||
} HRilNotification;
|
||||
#endif // OHOS_RIL_NOTIFICATION_H
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
struct BaseContext {
|
||||
napi_async_work work = nullptr;
|
||||
napi_deferred deferred = nullptr;
|
||||
napi_ref callbackRef = nullptr;
|
||||
bool resolved = false;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // BASE_CONTEXT_H
|
245
interfaces/innerkits/api/napi_util.cpp
Executable file
245
interfaces/innerkits/api/napi_util.cpp
Executable file
@ -0,0 +1,245 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#include "napi_util.h"
|
||||
#include <codecvt>
|
||||
#include <cstdio>
|
||||
#include <locale>
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#include "telephony_log_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
std::string NapiUtil::ToUtf8(std::u16string str16)
|
||||
{
|
||||
return std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> {}.to_bytes(str16);
|
||||
}
|
||||
|
||||
std::u16string NapiUtil::ToUtf16(std::string str)
|
||||
{
|
||||
return std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> {}.from_bytes(str);
|
||||
}
|
||||
|
||||
napi_value NapiUtil::CreateErrorMessage(napi_env env, std::string msg, int32_t errorCode)
|
||||
{
|
||||
napi_value result = nullptr;
|
||||
napi_value message = nullptr;
|
||||
NAPI_CALL(env, napi_create_string_utf8(env, msg.c_str(), msg.length(), &message));
|
||||
napi_value codeValue = nullptr;
|
||||
std::string errCode = std::to_string(errorCode);
|
||||
NAPI_CALL(env, napi_create_string_utf8(env, errCode.c_str(), errCode.length(), &codeValue));
|
||||
NAPI_CALL(env, napi_create_error(env, codeValue, message, &result));
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value NapiUtil::CreateUndefined(napi_env env)
|
||||
{
|
||||
napi_value result = nullptr;
|
||||
napi_get_undefined(env, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool NapiUtil::MatchValueType(napi_env env, napi_value value, napi_valuetype targetType)
|
||||
{
|
||||
napi_valuetype valueType = napi_undefined;
|
||||
napi_typeof(env, value, &valueType);
|
||||
return valueType == targetType;
|
||||
}
|
||||
|
||||
bool NapiUtil::MatchParameters(
|
||||
napi_env env, const napi_value parameters[], std::initializer_list<napi_valuetype> valueTypes)
|
||||
{
|
||||
if (parameters == nullptr) {
|
||||
return false;
|
||||
}
|
||||
int i = 0;
|
||||
for (auto beg = valueTypes.begin(); beg != valueTypes.end(); ++beg) {
|
||||
if (!MatchValueType(env, parameters[i], *beg)) {
|
||||
return false;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void NapiUtil::SetPropertyInt32(napi_env env, napi_value object, std::string name, int32_t value)
|
||||
{
|
||||
napi_value propertyValue = nullptr;
|
||||
napi_create_int32(env, value, &propertyValue);
|
||||
napi_set_named_property(env, object, name.c_str(), propertyValue);
|
||||
}
|
||||
|
||||
void NapiUtil::SetPropertyStringUtf8(napi_env env, napi_value object, std::string name, std::string value)
|
||||
{
|
||||
napi_value propertyValue = nullptr;
|
||||
napi_create_string_utf8(env, value.c_str(), name.length(), &propertyValue);
|
||||
napi_set_named_property(env, object, name.c_str(), propertyValue);
|
||||
}
|
||||
|
||||
void NapiUtil::SetPropertyBoolean(napi_env env, napi_value object, std::string name, bool value)
|
||||
{
|
||||
napi_value propertyValue = nullptr;
|
||||
napi_get_boolean(env, value, &propertyValue);
|
||||
napi_set_named_property(env, object, name.c_str(), propertyValue);
|
||||
}
|
||||
|
||||
napi_value NapiUtil::ToInt32Value(napi_env env, int32_t value)
|
||||
{
|
||||
napi_value staticValue = nullptr;
|
||||
NAPI_CALL(env, napi_create_int32(env, value, &staticValue));
|
||||
return staticValue;
|
||||
}
|
||||
|
||||
bool NapiUtil::HasNamedProperty(napi_env env, napi_value object, std::string propertyName)
|
||||
{
|
||||
bool hasProperty = false;
|
||||
napi_has_named_property(env, object, propertyName.data(), &hasProperty);
|
||||
return hasProperty;
|
||||
}
|
||||
|
||||
bool NapiUtil::HasNamedTypeProperty(napi_env env, napi_value object, napi_valuetype type, std::string propertyName)
|
||||
{
|
||||
bool hasProperty = false;
|
||||
napi_has_named_property(env, object, propertyName.data(), &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_named_property(env, object, propertyName.data(), &value);
|
||||
return MatchValueType(env, value, type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NapiUtil::MatchObjectProperty(
|
||||
napi_env env, napi_value object, std::initializer_list<std::pair<std::string, napi_valuetype>> pairList)
|
||||
{
|
||||
if (object == nullptr) {
|
||||
return false;
|
||||
}
|
||||
for (auto beg = pairList.begin(); beg != pairList.end(); ++beg) {
|
||||
if (!HasNamedTypeProperty(env, object, beg->second, beg->first)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NapiUtil::MatchOptionPropertyType(
|
||||
napi_env env, napi_value object, napi_valuetype type, std::string propertyName)
|
||||
{
|
||||
bool hasProperty = false;
|
||||
napi_has_named_property(env, object, propertyName.data(), &hasProperty);
|
||||
if (hasProperty) {
|
||||
napi_value value = nullptr;
|
||||
napi_get_named_property(env, object, propertyName.data(), &value);
|
||||
return MatchValueType(env, value, type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string NapiUtil::GetStringFromValue(napi_env env, napi_value value)
|
||||
{
|
||||
char msgChars[MAX_TEXT_LENGTH] = {0};
|
||||
size_t msgLength = 0;
|
||||
napi_get_value_string_utf8(env, value, msgChars, MAX_TEXT_LENGTH, &msgLength);
|
||||
TELEPHONY_LOGD("NapiUtil GetStringFromValue msgLength = %{public}zu", msgLength);
|
||||
if (msgLength > 0) {
|
||||
return std::string(msgChars, 0, msgLength);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
napi_value NapiUtil::GetNamedProperty(napi_env env, napi_value object, std::string propertyName)
|
||||
{
|
||||
napi_value value = nullptr;
|
||||
napi_get_named_property(env, object, propertyName.data(), &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
napi_value NapiUtil::HandleAsyncWork(napi_env env, BaseContext *context, std::string workName,
|
||||
napi_async_execute_callback execute, napi_async_complete_callback complete)
|
||||
{
|
||||
TELEPHONY_LOGD("NapiUtil HandleAsyncWork start workName = %{public}s", workName.c_str());
|
||||
napi_value result = nullptr;
|
||||
bool noCallback = context->callbackRef == nullptr;
|
||||
TELEPHONY_LOGD("NapiUtil HandleAsyncWork noCallback = %{public}d", noCallback);
|
||||
if (noCallback) {
|
||||
napi_status createStatus = napi_create_promise(env, &context->deferred, &result);
|
||||
TELEPHONY_LOGD("NapiUtil HandleAsyncWork napi_create_promise createStatus %{public}d", createStatus);
|
||||
} else {
|
||||
napi_get_undefined(env, &result);
|
||||
}
|
||||
napi_value resource = CreateUndefined(env);
|
||||
napi_value resourceName = nullptr;
|
||||
napi_create_string_utf8(env, workName.data(), NAPI_AUTO_LENGTH, &resourceName);
|
||||
napi_create_async_work(env, resource, resourceName, execute, complete, (void *)context, &context->work);
|
||||
napi_queue_async_work(env, context->work);
|
||||
return result;
|
||||
}
|
||||
|
||||
void NapiUtil::Handle1ValueCallback(napi_env env, BaseContext *baseContext, napi_value callbackValue)
|
||||
{
|
||||
std::unique_ptr<BaseContext> context(baseContext);
|
||||
if (context == nullptr) {
|
||||
std::string errorCode = std::to_string(napi_invalid_arg);
|
||||
std::string errorMessage = "error at baseContext is nullptr";
|
||||
NAPI_CALL_RETURN_VOID(env, napi_throw_error(env, errorCode.c_str(), errorMessage.c_str()));
|
||||
}
|
||||
if (context->callbackRef != nullptr) {
|
||||
napi_value recv = CreateUndefined(env);
|
||||
napi_value callbackFunc = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_get_reference_value(env, context->callbackRef, &callbackFunc));
|
||||
napi_value callbackValues[] = {callbackValue};
|
||||
napi_value result = nullptr;
|
||||
NAPI_CALL_RETURN_VOID(
|
||||
env, napi_call_function(env, recv, callbackFunc, std::size(callbackValues), callbackValues, &result));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_delete_reference(env, context->callbackRef));
|
||||
} else if (context->deferred != nullptr) {
|
||||
if (context->resolved) {
|
||||
NAPI_CALL_RETURN_VOID(env, napi_resolve_deferred(env, context->deferred, callbackValue));
|
||||
} else {
|
||||
NAPI_CALL_RETURN_VOID(env, napi_reject_deferred(env, context->deferred, callbackValue));
|
||||
}
|
||||
}
|
||||
NAPI_CALL_RETURN_VOID(env, napi_delete_async_work(env, context->work));
|
||||
}
|
||||
|
||||
void NapiUtil::Handle2ValueCallback(napi_env env, BaseContext *context, napi_value callbackValue)
|
||||
{
|
||||
if (context->callbackRef != nullptr) {
|
||||
TELEPHONY_LOGD("Handle2ValueCallback normal callback resolved = %{public}d", context->resolved);
|
||||
napi_value recv = CreateUndefined(env);
|
||||
napi_value callbackFunc = nullptr;
|
||||
napi_get_reference_value(env, context->callbackRef, &callbackFunc);
|
||||
napi_value callbackValues[] = {nullptr, nullptr};
|
||||
callbackValues[0] = context->resolved ? CreateUndefined(env) : callbackValue;
|
||||
callbackValues[1] = context->resolved ? callbackValue : CreateUndefined(env);
|
||||
napi_value result = nullptr;
|
||||
napi_call_function(env, recv, callbackFunc, std::size(callbackValues), callbackValues, &result);
|
||||
napi_delete_reference(env, context->callbackRef);
|
||||
} else if (context->deferred != nullptr) {
|
||||
TELEPHONY_LOGD("Handle2ValueCallback promise callback resolved = %{public}d", context->resolved);
|
||||
if (context->resolved) {
|
||||
napi_resolve_deferred(env, context->deferred, callbackValue);
|
||||
} else {
|
||||
napi_reject_deferred(env, context->deferred, callbackValue);
|
||||
}
|
||||
}
|
||||
napi_delete_async_work(env, context->work);
|
||||
delete context;
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
140
interfaces/innerkits/api/napi_util.h
Normal file
140
interfaces/innerkits/api/napi_util.h
Normal file
@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef BASE_TELEPHONY_NAPI_NAPI_UTIL_H
|
||||
#define BASE_TELEPHONY_NAPI_NAPI_UTIL_H
|
||||
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "telephony_napi_common_error.h"
|
||||
#include "base_context.h"
|
||||
#include "napi/native_api.h"
|
||||
#include "napi/native_node_api.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
using vecNapiType = std::vector<napi_valuetype>;
|
||||
|
||||
class NapiUtil {
|
||||
public:
|
||||
static const int32_t MAX_TEXT_LENGTH = 4096;
|
||||
static std::string ToUtf8(std::u16string str16);
|
||||
static std::u16string ToUtf16(std::string str);
|
||||
static napi_value CreateErrorMessage(napi_env env, std::string message, int32_t errorCode = ERROR_DEFAULT);
|
||||
static napi_value CreateUndefined(napi_env env);
|
||||
static bool MatchValueType(napi_env env, napi_value value, napi_valuetype targetType);
|
||||
static bool MatchParameters(
|
||||
napi_env env, const napi_value parameters[], std::initializer_list<napi_valuetype> valueTypes);
|
||||
static void SetPropertyInt32(napi_env env, napi_value object, std::string name, int32_t value);
|
||||
static void SetPropertyStringUtf8(napi_env env, napi_value object, std::string name, std::string value);
|
||||
static void SetPropertyBoolean(napi_env env, napi_value object, std::string name, bool value);
|
||||
static napi_value ToInt32Value(napi_env env, int value);
|
||||
static bool HasNamedProperty(napi_env env, napi_value object, std::string propertyName);
|
||||
static bool HasNamedTypeProperty(
|
||||
napi_env env, napi_value object, napi_valuetype type, std::string propertyName);
|
||||
static bool MatchObjectProperty(
|
||||
napi_env env, napi_value object, std::initializer_list<std::pair<std::string, napi_valuetype>> pairList);
|
||||
static bool MatchOptionPropertyType(
|
||||
napi_env env, napi_value object, napi_valuetype type, std::string propertyName);
|
||||
static std::string GetStringFromValue(napi_env env, napi_value value);
|
||||
static napi_value GetNamedProperty(napi_env env, napi_value object, std::string propertyName);
|
||||
static napi_value HandleAsyncWork(napi_env env, BaseContext *context, std::string workName,
|
||||
napi_async_execute_callback execute, napi_async_complete_callback complete);
|
||||
static void Handle1ValueCallback(napi_env env, BaseContext *context, napi_value callbackValue);
|
||||
static void Handle2ValueCallback(napi_env env, BaseContext *context, napi_value callbackValue);
|
||||
};
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_same_v<T, bool>, int32_t> = 0>
|
||||
napi_value GetNapiValue(napi_env env, T val)
|
||||
{
|
||||
napi_value result = nullptr;
|
||||
napi_get_boolean(env, val, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_same_v<T, int32_t>, int32_t> = 0>
|
||||
napi_value GetNapiValue(napi_env env, T val)
|
||||
{
|
||||
napi_value result = nullptr;
|
||||
napi_create_int32(env, val, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_same_v<T, std::string>, int32_t> = 0>
|
||||
napi_value GetNapiValue(napi_env env, T val)
|
||||
{
|
||||
napi_value result = nullptr;
|
||||
napi_create_string_utf8(env, val.c_str(), val.length(), &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_same_v<T, napi_value>, int32_t> = 0>
|
||||
napi_value GetNapiValue(napi_env env, T val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_same_v<T, int32_t>, int32_t> = 0>
|
||||
napi_status NapiValueConverted(napi_env env, napi_value arg, T *val)
|
||||
{
|
||||
return napi_get_value_int32(env, arg, val);
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_same_v<T, napi_ref>, int32_t> = 0>
|
||||
napi_status NapiValueConverted(napi_env env, napi_value arg, T *ref)
|
||||
{
|
||||
return napi_create_reference(env, arg, 1, ref);
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_same_v<T, char>, int32_t> = 0>
|
||||
napi_status NapiValueConverted(napi_env env, napi_value arg, T *buf)
|
||||
{
|
||||
constexpr size_t bufSize = 32;
|
||||
size_t result {0};
|
||||
return napi_get_value_string_utf8(env, arg, buf, bufSize, &result);
|
||||
}
|
||||
|
||||
template<typename... Ts>
|
||||
bool MatchParameters(
|
||||
napi_env env, const napi_value argv[], size_t argc, std::tuple<Ts...> &theTuple, const vecNapiType &typeStd)
|
||||
{
|
||||
bool typeMatched = false;
|
||||
if (argc == typeStd.size()) {
|
||||
vecNapiType paraType;
|
||||
paraType.reserve(argc);
|
||||
for (size_t i = 0; i < argc; i++) {
|
||||
napi_valuetype valueType = napi_undefined;
|
||||
napi_typeof(env, argv[i], &valueType);
|
||||
paraType.emplace_back(valueType);
|
||||
}
|
||||
|
||||
if (paraType == typeStd) {
|
||||
std::apply(
|
||||
[env, argc, &argv](Ts &...tupleArgs) {
|
||||
size_t index {0};
|
||||
((index < argc ? NapiValueConverted(env, argv[index++], tupleArgs) : napi_ok), ...);
|
||||
},
|
||||
theTuple);
|
||||
typeMatched = true;
|
||||
}
|
||||
}
|
||||
return typeMatched;
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // NAPI_UTIL_H
|
28
interfaces/innerkits/api/telephony_napi_common_error.h
Normal file
28
interfaces/innerkits/api/telephony_napi_common_error.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef TELEPHONY_NAPI_COMMON_ERROR_H
|
||||
#define TELEPHONY_NAPI_COMMON_ERROR_H
|
||||
#include <cstdint>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
const int32_t ERROR_NONE = 0;
|
||||
const int32_t ERROR_DEFAULT = -1;
|
||||
const int32_t ERROR_SERVICE_UNAVAILABLE = -2;
|
||||
const int32_t ERROR_PARAMETER_VALUE_INVALID = -3;
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // TELEPHONY_NAPI_COMMON_ERROR_H
|
@ -15,13 +15,15 @@
|
||||
|
||||
#ifndef CALL_MANAGER_ERRORS_H
|
||||
#define CALL_MANAGER_ERRORS_H
|
||||
#include "../../../core_service/interfaces/innerkits/common/telephony_errors.h"
|
||||
|
||||
#include "../../common/telephony_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
enum {
|
||||
CALL_MANAGER_PHONENUM_NULL = CALL_MANAGER_ERR_OFFSET,
|
||||
namespace Telephony {
|
||||
enum CallManagerErrorCode {
|
||||
CALL_MANAGER_PHONE_NUMBER_NULL = CALL_ERR_OFFSET,
|
||||
CALL_MANAGER_DIAL_FAILED,
|
||||
CALL_MANAGER_ACCPET_FAILED,
|
||||
CALL_MANAGER_ACCEPT_FAILED,
|
||||
CALL_MANAGER_REJECT_FAILED,
|
||||
CALL_MANAGER_HOLD_FAILED,
|
||||
CALL_MANAGER_UNHOLD_FAILED,
|
||||
@ -31,14 +33,64 @@ enum {
|
||||
CALL_MANAGER_CREATE_CALL_OBJECT_FAIL,
|
||||
CALL_MANAGER_SETAUDIO_FAILED,
|
||||
CALL_MANAGER_CALL_NULL,
|
||||
CALL_MANAGER_CALL_EXIST,
|
||||
CALL_MANAGER_CALL_EXIST, // already exists and needs to be deleted
|
||||
CALL_MANAGER_CALL_DISCONNECTED,
|
||||
CALL_MANAGER_PHONE_BEYOND,
|
||||
CALL_MANAGER_HAS_NEW_CALL,
|
||||
CALL_MANAGER_VIDEO_MODE_ERR,
|
||||
CALL_MANAGER_PHONENUM_INVALID,
|
||||
CALL_MANAGER_PHONE_NUMBER_INVALID,
|
||||
CALL_MANAGER_CALLID_INVALID,
|
||||
CALL_MANAGER_CURRENT_RINGING,
|
||||
CALL_MANAGER_SWAP_FAILED,
|
||||
CALL_MANAGER_CALL_IS_NOT_ACTIVATED,
|
||||
CALL_MANAGER_CALL_IS_NOT_ON_HOLDING,
|
||||
CALL_MANAGER_SET_MUTE_FAILED,
|
||||
CALL_MANAGER_MUTE_RINGER_FAILED,
|
||||
CALL_MANAGER_SET_AUDIO_DEVICE_FAILED,
|
||||
CALL_MANAGER_GET_IS_RINGING_FAILED,
|
||||
CALL_MANAGER_UPDATE_CALL_STATE_FAILED,
|
||||
CALL_MANAGER_UPDATE_CALL_EVENT_FAILED,
|
||||
CALL_MANAGER_ILLEGAL_CALL_OPERATION,
|
||||
CALL_MANAGER_CALL_STATE_MISMATCH_OPERATION,
|
||||
CALL_MANAGER_START_DTMF_FAILED,
|
||||
CALL_MANAGER_SEND_DTMF_FAILED,
|
||||
CALL_MANAGER_SEND_DTMF_BUNCH_FAILED,
|
||||
CALL_MANAGER_STOP_DTMF_FAILED,
|
||||
CALL_MANAGER_SEND_DTMF_INPUT_IS_EMPTY,
|
||||
CALL_MANAGER_DTMF_PARAMETER_INVALID,
|
||||
CALL_MANAGER_FORMATTING_FAILED,
|
||||
CALL_MANAGER_CONFERENCE_NOT_EXISTS,
|
||||
CALL_MANAGER_CONFERENCE_CALL_EXCEED_LIMIT,
|
||||
CALL_MANAGER_UNKNOW_DIAL_TYPE,
|
||||
CALL_MANAGER_HAS_CALLBACK,
|
||||
|
||||
// cellular call
|
||||
ERR_PARAMETER_INVALID, // parameter error or invalid
|
||||
ERR_CALL_STATE, // call state error
|
||||
ERR_CALL_NUMBER_LIMIT, // call number limit
|
||||
ERR_MMI_TYPE, // include:Supplementary Service、USSD
|
||||
ERR_SYSTEM_INVOKE, // Error calling standard system library function, such as: strcpy_s、 memset_s
|
||||
ERR_CONNECTION, // Connection is null
|
||||
ERR_GET_RADIO_STATE, // radio state error
|
||||
ERR_REPORT_CALLS_INFO, // report calls info error
|
||||
ERR_NETWORK_TYPE, // Network type error
|
||||
ERR_NULL_POINTER, // pointer is nullptr
|
||||
ERR_PHONE_NUMBER_EMPTY, // phone number is empty
|
||||
ERR_INVALID_SLOT_ID, // invalid slot id
|
||||
};
|
||||
} // namespace TelephonyCallManager
|
||||
|
||||
// 3GPP TS 24.008 V3.9.0 (2001-09) 10.5.4.11 Cause
|
||||
enum PROTOCOL_ERROR_TYPE {
|
||||
ERR_PARAMETER_OUT_OF_RANGE = PROTOCOL_ERR_OFFSET, // (e.g. parameter out of range)
|
||||
ERR_CALL_ALREADY_EXISTS, // Call completed elsewhere
|
||||
ERR_RADIO_STATE, // Radio state error, Network out of order
|
||||
ERR_MANDATORY_INFO_INVALID, // Invalid mandatory information
|
||||
ERR_RESOURCE_UNAVAILABLE, // Resources unavailable, unspecified
|
||||
ERR_OPTION_NOT_AVAILABLE, // service or option not available
|
||||
ERR_OPTION_NOT_IMPLEMENTED, // service or option not implemented
|
||||
ERR_DESCRIPTOR_INVALID, // descriptor checked fail, Invalid transaction identifier value
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // CALLMANAGER_ERRORS_H
|
||||
|
||||
#endif // CALL_MANAGER_ERRORS_H
|
||||
|
300
interfaces/innerkits/call_manager/common/call_manager_inner_type.h
Executable file
300
interfaces/innerkits/call_manager/common/call_manager_inner_type.h
Executable file
@ -0,0 +1,300 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef CALL_MANAGER_INNER_TYPE_H
|
||||
#define CALL_MANAGER_INNER_TYPE_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
const int kMaxNumberLen = 30;
|
||||
const int kMaxSchemeNumberLen = 4;
|
||||
const uint32_t REJECT_CALL_MSG_MAX_LEN = 300;
|
||||
constexpr uint32_t MAX_CALL_COUNT = 15;
|
||||
constexpr uint32_t ACCOUNT_NUMBER_MAX_LENGTH = 100;
|
||||
constexpr uint32_t CONNECT_SERVICE_WAIT_TIME = 1000; // ms
|
||||
constexpr int32_t ERR_ID = -1;
|
||||
|
||||
// call type
|
||||
enum CallType {
|
||||
TYPE_CS = 0, // CS
|
||||
TYPE_IMS = 1, // IMS
|
||||
TYPE_OTT = 2, // OTT
|
||||
TYPE_ERR_CALL = 3, // OTHER
|
||||
};
|
||||
|
||||
// call state
|
||||
enum TelCallState {
|
||||
CALL_STATUS_ACTIVE = 0,
|
||||
CALL_STATUS_HOLDING,
|
||||
CALL_STATUS_DIALING,
|
||||
CALL_STATUS_ALERTING,
|
||||
CALL_STATUS_INCOMING,
|
||||
CALL_STATUS_WAITING,
|
||||
CALL_STATUS_DISCONNECTED,
|
||||
CALL_STATUS_DISCONNECTING,
|
||||
CALL_STATUS_IDLE,
|
||||
};
|
||||
|
||||
enum TelConferenceState {
|
||||
TEL_CONFERENCE_IDLE = 0,
|
||||
TEL_CONFERENCE_ACTIVE,
|
||||
TEL_CONFERENCE_DISCONNECTING,
|
||||
TEL_CONFERENCE_DISCONNECTED,
|
||||
};
|
||||
|
||||
// phone type
|
||||
enum PhoneNetType {
|
||||
PHONE_TYPE_GSM = 1, // gsm
|
||||
PHONE_TYPE_CDMA = 2, // cdma
|
||||
};
|
||||
|
||||
// call mode
|
||||
enum VideoStateType {
|
||||
TYPE_VOICE = 0, // Voice
|
||||
TYPE_VIDEO, // Video
|
||||
};
|
||||
|
||||
enum DialScene {
|
||||
CALL_NORMAL = 0,
|
||||
CALL_PRIVILEGED,
|
||||
CALL_EMERGENCY,
|
||||
};
|
||||
|
||||
enum CallDirection {
|
||||
CALL_DIRECTION_OUT = 0,
|
||||
CALL_DIRECTION_IN,
|
||||
CALL_DIRECTION_UNKNOW,
|
||||
};
|
||||
|
||||
enum class CallRunningState {
|
||||
CALL_RUNNING_STATE_CREATE = 0, // A new session
|
||||
CALL_RUNNING_STATE_CONNECTING,
|
||||
CALL_RUNNING_STATE_DIALING,
|
||||
CALL_RUNNING_STATE_RINGING,
|
||||
CALL_RUNNING_STATE_ACTIVE,
|
||||
CALL_RUNNING_STATE_HOLD,
|
||||
CALL_RUNNING_STATE_ENDED,
|
||||
CALL_RUNNING_STATE_ENDING,
|
||||
};
|
||||
|
||||
enum class CallEndedType {
|
||||
UNKNOWN = 0,
|
||||
PHONE_IS_BUSY,
|
||||
INVALID_NUMBER,
|
||||
CALL_ENDED_NORMALLY,
|
||||
};
|
||||
|
||||
struct SIMCardInfo {
|
||||
int32_t simId; // IccId
|
||||
int32_t country;
|
||||
int32_t state; // SIM card active status
|
||||
PhoneNetType phoneNetType;
|
||||
};
|
||||
|
||||
enum class DialType {
|
||||
DIAL_CARRIER_TYPE = 0,
|
||||
DIAL_VOICE_MAIL_TYPE,
|
||||
DIAL_OTT_TYPE,
|
||||
DIAL_UNKNOW_TYPE,
|
||||
};
|
||||
|
||||
enum class CallStateToApp {
|
||||
/**
|
||||
* Indicates an invalid state, which is used when the call state fails to be obtained.
|
||||
*/
|
||||
CALL_STATE_UNKNOWN = -1,
|
||||
|
||||
/**
|
||||
* Indicates that there is no ongoing call.
|
||||
*/
|
||||
CALL_STATE_IDLE = 0,
|
||||
|
||||
/**
|
||||
* Indicates that an incoming call is ringing or waiting.
|
||||
*/
|
||||
CALL_STATE_RINGING = 1,
|
||||
|
||||
/**
|
||||
* Indicates that a least one call is in the dialing, active, or hold state, and there is no new incoming call
|
||||
* ringing or waiting.
|
||||
*/
|
||||
CALL_STATE_OFFHOOK = 2
|
||||
};
|
||||
|
||||
struct CallAttributeInfo {
|
||||
char accountNumber[kMaxNumberLen];
|
||||
bool speakerphoneOn;
|
||||
int32_t accountId;
|
||||
VideoStateType videoState;
|
||||
int32_t startTime; // Call start time
|
||||
bool isEcc;
|
||||
CallType callType;
|
||||
int32_t callId;
|
||||
TelCallState callState;
|
||||
TelConferenceState conferenceState;
|
||||
};
|
||||
|
||||
enum CallAbilityEventId {
|
||||
EVENT_DIAL_AT_CMD_SEND_FAILED = 0,
|
||||
EVENT_DIAL_NO_CARRIER,
|
||||
EVENT_START_DTMF_SUCCESS,
|
||||
EVENT_START_DTMF_FAILED,
|
||||
EVENT_STOP_DTMF_SUCCESS,
|
||||
EVENT_STOP_DTMF_FAILED,
|
||||
EVENT_SEND_DTMF_SUCCESS,
|
||||
EVENT_SEND_DTMF_FAILED,
|
||||
EVENT_SEND_DTMF_STRING_SUCCESS,
|
||||
EVENT_SEND_DTMF_STRING_FAILED,
|
||||
EVENT_UNKNOW_ID,
|
||||
};
|
||||
|
||||
struct CallEventInfo {
|
||||
CallAbilityEventId eventId;
|
||||
};
|
||||
|
||||
struct AccountInfo {
|
||||
int32_t accountId;
|
||||
int32_t power;
|
||||
char bundleName[kMaxNumberLen];
|
||||
bool isEnabled;
|
||||
};
|
||||
|
||||
struct CallReportInfo {
|
||||
char accountNum[kMaxNumberLen]; // call phone number
|
||||
int32_t accountId;
|
||||
CallType callType; // call type: CS、IMS
|
||||
VideoStateType callMode; // call mode: video or audio
|
||||
TelCallState state;
|
||||
int32_t index;
|
||||
};
|
||||
|
||||
struct CallsReportInfo {
|
||||
std::vector<CallReportInfo> callVec;
|
||||
int32_t slotId;
|
||||
};
|
||||
|
||||
enum class DisconnectedDetails {
|
||||
UNKNOWN = 0,
|
||||
};
|
||||
|
||||
enum AudioDevice {
|
||||
DEVICE_MIC = 0,
|
||||
DEVICE_SPEAKER,
|
||||
DEVICE_WIRED_HEADSET,
|
||||
DEVICE_BLUETOOTH_SCO,
|
||||
DEVICE_DISABLE,
|
||||
DEVICE_UNKNOWN,
|
||||
};
|
||||
|
||||
enum CellularCallEventType {
|
||||
EVENT_REQUEST_RESULT_TYPE = 0,
|
||||
};
|
||||
|
||||
enum RequestResultEventId {
|
||||
RESULT_DIAL_SEND_FAILED = 0,
|
||||
RESULT_DIAL_NO_CARRIER = 1,
|
||||
RESULT_END_SEND_FAILED = 2,
|
||||
RESULT_REJECT_SEND_FAILED = 3,
|
||||
RESULT_ACCEPT_SEND_FAILED = 4,
|
||||
RESULT_HOLD_SEND_FAILED = 5,
|
||||
RESULT_ACTIVE_SEND_FAILED = 6,
|
||||
RESULT_SWAP_SEND_FAILED = 7,
|
||||
RESULT_JOIN_SEND_FAILED = 8,
|
||||
RESULT_SPLIT_SEND_FAILED = 9,
|
||||
RESULT_SUPPLEMENT_SEND_FAILED = 10,
|
||||
RESULT_INITIATE_DTMF_SUCCESS = 11,
|
||||
RESULT_INITIATE_DTMF_FAILED = 12,
|
||||
RESULT_CEASE_DTMF_SUCCESS = 13,
|
||||
RESULT_CEASE_DTMF_FAILED = 14,
|
||||
RESULT_TRANSMIT_DTMF_SUCCESS = 15,
|
||||
RESULT_TRANSMIT_DTMF_FAILED = 16,
|
||||
RESULT_TRANSMIT_DTMF_STRING_SUCCESS = 17,
|
||||
RESULT_TRANSMIT_DTMF_STRING_FAILED = 18,
|
||||
RESULT_GET_CURRENT_CALLS_FAILED = 19,
|
||||
};
|
||||
|
||||
enum CallResultReportId {
|
||||
GET_CALL_WAITING_REPORT_ID = 0,
|
||||
SET_CALL_WAITING_REPORT_ID,
|
||||
GET_CALL_RESTRICTION_REPORT_ID,
|
||||
SET_CALL_RESTRICTION_REPORT_ID,
|
||||
GET_CALL_TRANSFER_REPORT_ID,
|
||||
SET_CALL_TRANSFER_REPORT_ID,
|
||||
GET_CALL_CLIP_ID,
|
||||
GET_CALL_CLIR_ID,
|
||||
SET_CALL_CLIR_ID,
|
||||
};
|
||||
|
||||
struct CellularCallEventInfo {
|
||||
CellularCallEventType eventType;
|
||||
RequestResultEventId eventId;
|
||||
};
|
||||
|
||||
struct CallWaitResponse {
|
||||
int32_t result; // 0: ok 1: error
|
||||
int32_t status;
|
||||
int32_t classCw;
|
||||
};
|
||||
|
||||
struct ClipResponse {
|
||||
int32_t result; // 0: ok 1: error
|
||||
int32_t action;
|
||||
int32_t clipStat;
|
||||
};
|
||||
|
||||
struct ClirResponse {
|
||||
int32_t result; // 0: ok 1: error
|
||||
int32_t action;
|
||||
int32_t clirStat;
|
||||
};
|
||||
|
||||
struct CallTransferResponse {
|
||||
int32_t result; // 0: ok 1: error
|
||||
int32_t status;
|
||||
int32_t classx;
|
||||
std::string number;
|
||||
int32_t type;
|
||||
};
|
||||
|
||||
struct CallRestrictionResponse {
|
||||
int32_t result; // 0: ok 1: error
|
||||
int32_t status; // parameter sets/shows the result code presentation status in the TA
|
||||
int32_t classCw; // parameter shows the subscriber CLIP service status in the network, <0-4>
|
||||
};
|
||||
|
||||
enum DtmfPlaytime {
|
||||
DTMF_PLAY_TONE_MSEC_0 = 0, // stop play
|
||||
DTMF_PLAY_TONE_MSEC_1 = 1,
|
||||
DTMF_PLAY_TONE_MSEC_2 = 95, // Play time, the length is milliseconds
|
||||
DTMF_PLAY_TONE_MSEC_3 = 150,
|
||||
DTMF_PLAY_TONE_MSEC_4 = 200,
|
||||
DTMF_PLAY_TONE_MSEC_5 = 250,
|
||||
DTMF_PLAY_TONE_MSEC_6 = 300,
|
||||
DTMF_PLAY_TONE_MSEC_7 = 350,
|
||||
DTMF_PLAY_TONE_DEFAULT_MSEC = 60000, // default play time
|
||||
};
|
||||
|
||||
enum DtmfPlayIntervalTime {
|
||||
DTMF_PLAY_TONE_MIN_INTERVAL_MSEC = 10, // Play interval time, the length is milliseconds
|
||||
DTMF_PLAY_TONE_MAX_INTERVAL_MSEC = 60000,
|
||||
DTMF_PLAY_TONE_DEFAULT_INTERVAL_MSEC = 0, // Default parameter
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // CALL_MANAGER_INNER_TYPE_H
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef TELEPHONY_LOG_H
|
||||
#define TELEPHONY_LOG_H
|
||||
#include <stdio.h>
|
||||
|
||||
#include "hilog/log.h"
|
||||
|
||||
#undef LOG_DOMAIN
|
||||
#undef LOG_TAG
|
||||
#define LOG_DOMAIN 0xD002B01
|
||||
#define LOG_TAG "CallManager"
|
||||
|
||||
#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
#define OHOS_DEBUG
|
||||
#ifndef OHOS_DEBUG
|
||||
#define DECORATOR_HILOG(op, fmt, args...) \
|
||||
do { \
|
||||
op(LOG_CORE, fmt, ##args); \
|
||||
} while (0)
|
||||
#else
|
||||
#define DECORATOR_HILOG(op, fmt, args...) \
|
||||
do { \
|
||||
op(LOG_CORE, "{%{public}s()-%{public}s:%{public}d} " fmt, __FUNCTION__, __FILENAME__, __LINE__, ##args); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define CALLMANAGER_DEBUG_LOG(fmt, ...) DECORATOR_HILOG(HILOG_DEBUG, fmt, ##__VA_ARGS__)
|
||||
#define CALLMANAGER_ERR_LOG(fmt, ...) DECORATOR_HILOG(HILOG_INFO, fmt, ##__VA_ARGS__)
|
||||
#define CALLMANAGER_WARNING_LOG(fmt, ...) DECORATOR_HILOG(HILOG_WARN, fmt, ##__VA_ARGS__)
|
||||
#define CALLMANAGER_INFO_LOG(fmt, ...) DECORATOR_HILOG(HILOG_ERROR, fmt, ##__VA_ARGS__)
|
||||
#define CALLMANAGER_FATAL_LOG(fmt, ...) DECORATOR_HILOG(HILOG_FATAL, fmt, ##__VA_ARGS__)
|
||||
|
||||
#define CALLMANAGER_OK 0
|
||||
#define CALLMANAGER_INVALID_PARAM (-1)
|
||||
#define CALLMANAGER_INIT_FAIL (-2)
|
||||
#define CALLMANAGER_ERR (-3)
|
||||
#define CALLMANAGER_PERMISSION_DENIED (-4)
|
||||
|
||||
#endif // TELEPHONY_LOG_H
|
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef CALL_MANAGER_TYPE_H
|
||||
#define CALL_MANAGER_TYPE_H
|
||||
#include <cstdio>
|
||||
|
||||
#include "call_types.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
const int kMaxSchemeNumberLen = 4;
|
||||
|
||||
enum DialScene {
|
||||
CALL_NORMAL = 0,
|
||||
CALL_PRIVILEGED,
|
||||
CALL_EMERGENCY,
|
||||
};
|
||||
|
||||
enum class CallStateType {
|
||||
CALL_STATE_CREATE_TYPE = 0, // A new session
|
||||
CALL_STATE_CONNECTING_TYPE,
|
||||
CALL_STATE_DIALING_TYPE,
|
||||
CALL_STATE_RINGING_TYPE,
|
||||
CALL_STATE_ACTIVE_TYPE,
|
||||
CALL_STATE_HOLD_TYPE,
|
||||
CALL_STATE_ENDED_TYPE,
|
||||
CALL_STATE_ENDING_TYPE,
|
||||
};
|
||||
|
||||
enum class CallEndedType {
|
||||
UNKNOWN = 0,
|
||||
PHONE_IS_BUSY,
|
||||
INVALID_NUMBER,
|
||||
CALL_ENDED_NORMALLY,
|
||||
};
|
||||
|
||||
struct SIMCardInfo {
|
||||
int32_t simId; // IccId
|
||||
int32_t country;
|
||||
int32_t state; // SIM card active status
|
||||
PhoneNetType phoneNetType;
|
||||
};
|
||||
|
||||
enum class CallStateToApp {
|
||||
/**
|
||||
* Indicates an invalid state, which is used when the call state fails to be obtained.
|
||||
*/
|
||||
CALL_STATE_UNKNOWN = -1,
|
||||
|
||||
/**
|
||||
* Indicates that there is no ongoing call.
|
||||
*/
|
||||
CALL_STATE_IDLE = 0,
|
||||
|
||||
/**
|
||||
* Indicates that an incoming call is ringing or waiting.
|
||||
*/
|
||||
CALL_STATE_RINGING = 1,
|
||||
|
||||
/**
|
||||
* Indicates that a least one call is in the dialing, active, or hold state, and there is no new incoming call
|
||||
* ringing or waiting.
|
||||
*/
|
||||
CALL_STATE_OFFHOOK = 2
|
||||
};
|
||||
|
||||
struct AccountInfo {
|
||||
int32_t slotId;
|
||||
int32_t power;
|
||||
char bundleName[kMaxNumberLen];
|
||||
bool isEnabled;
|
||||
};
|
||||
|
||||
struct CellularCallReportInfo {
|
||||
char phoneNum[kMaxNumberLen]; // call phone number
|
||||
int32_t phoneId;
|
||||
CallType callType; // call type: CS、IMS
|
||||
VedioStateType callMode; // call mode: video or audio
|
||||
TelCallStates state;
|
||||
};
|
||||
|
||||
struct CallReportInfo {
|
||||
char accountNum[kMaxNumberLen]; // call phone number
|
||||
int32_t accountId;
|
||||
CallType callType; // call type: CS、IMS
|
||||
VedioStateType callMode; // call mode: video or audio
|
||||
TelCallStates state;
|
||||
};
|
||||
|
||||
struct CallsReportInfo {
|
||||
std::vector<CallReportInfo> callVec;
|
||||
int32_t slotId;
|
||||
};
|
||||
|
||||
enum class DisconnectedDetails {
|
||||
UNKNOWN = 0,
|
||||
};
|
||||
} // namespace TelephonyCallManager
|
||||
} // namespace OHOS
|
||||
#endif // CALL_MANAGER_TYPE_H
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#include "call_ability_callback_death_recipient.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
CallAbilityCallbackDeathRecipient::CallAbilityCallbackDeathRecipient(
|
||||
const std::function<void(const wptr<IRemoteObject> &object)> &deathCallback)
|
||||
: deathCallback_(deathCallback)
|
||||
{}
|
||||
|
||||
void CallAbilityCallbackDeathRecipient::OnRemoteDied(const OHOS::wptr<OHOS::IRemoteObject> &object)
|
||||
{
|
||||
if (deathCallback_) {
|
||||
deathCallback_(object);
|
||||
}
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef CALL_ABILITY_CALLBACK_DEATH_RECIPIENT_H
|
||||
#define CALL_ABILITY_CALLBACK_DEATH_RECIPIENT_H
|
||||
|
||||
#include "iremote_broker.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class CallAbilityCallbackDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
public:
|
||||
explicit CallAbilityCallbackDeathRecipient(
|
||||
const std::function<void(const wptr<IRemoteObject> &object)> &deathCallback);
|
||||
virtual ~CallAbilityCallbackDeathRecipient() = default;
|
||||
|
||||
void OnRemoteDied(const wptr<IRemoteObject> &object) override;
|
||||
|
||||
private:
|
||||
std::function<void(const wptr<IRemoteObject> &object)> deathCallback_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // CALL_ABILITY_CALLBACK_DEATH_RECIPIENT_H
|
131
interfaces/innerkits/call_manager/proxy/call_ability_callback_proxy.cpp
Executable file
131
interfaces/innerkits/call_manager/proxy/call_ability_callback_proxy.cpp
Executable file
@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#include "call_ability_callback_proxy.h"
|
||||
|
||||
#include "message_option.h"
|
||||
#include "message_parcel.h"
|
||||
|
||||
#include "call_manager_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
CallAbilityCallbackProxy::CallAbilityCallbackProxy(const sptr<IRemoteObject> &impl)
|
||||
: IRemoteProxy<ICallAbilityCallback>(impl)
|
||||
{}
|
||||
|
||||
int32_t CallAbilityCallbackProxy::OnCallDetailsChange(const CallAttributeInfo &info)
|
||||
{
|
||||
TELEPHONY_LOGE("start");
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_UPDATE_CALL_STATE_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallAbilityCallbackProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
int32_t length = sizeof(CallAttributeInfo);
|
||||
dataParcel.WriteInt32(length);
|
||||
dataParcel.WriteRawData((const void *)&info, length);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_CALL_STATE_INFO, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("update call state info failed, error: %{public}d", error);
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
TELEPHONY_LOGE("end");
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallAbilityCallbackProxy::OnCallEventChange(const CallEventInfo &info)
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_UPDATE_CALL_EVENT_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallAbilityCallbackProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
int32_t length = sizeof(CallEventInfo);
|
||||
dataParcel.WriteInt32(length);
|
||||
dataParcel.WriteRawData((const void *)&info, length);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_CALL_EVENT, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("update call event failed, error: %{public}d", error);
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallAbilityCallbackProxy::OnSupplementResult(CallResultReportId reportId, AppExecFwk::PacMap &resultInfo)
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
if (!dataParcel.WriteInterfaceToken(CallAbilityCallbackProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(reportId);
|
||||
dataParcel.WriteInt32(resultInfo.GetIntValue("result"));
|
||||
switch (reportId) {
|
||||
case CallResultReportId::GET_CALL_WAITING_REPORT_ID:
|
||||
case CallResultReportId::GET_CALL_RESTRICTION_REPORT_ID:
|
||||
dataParcel.WriteInt32(resultInfo.GetIntValue("status"));
|
||||
dataParcel.WriteInt32(resultInfo.GetIntValue("classCw"));
|
||||
break;
|
||||
case CallResultReportId::GET_CALL_TRANSFER_REPORT_ID:
|
||||
dataParcel.WriteInt32(resultInfo.GetIntValue("status"));
|
||||
dataParcel.WriteInt32(resultInfo.GetIntValue("classx"));
|
||||
dataParcel.WriteString(resultInfo.GetStringValue("number"));
|
||||
dataParcel.WriteInt32(resultInfo.GetIntValue("type"));
|
||||
break;
|
||||
case CallResultReportId::GET_CALL_CLIP_ID:
|
||||
dataParcel.WriteInt32(resultInfo.GetIntValue("action"));
|
||||
dataParcel.WriteInt32(resultInfo.GetIntValue("clipStat"));
|
||||
break;
|
||||
case CallResultReportId::GET_CALL_CLIR_ID:
|
||||
dataParcel.WriteInt32(resultInfo.GetIntValue("action"));
|
||||
dataParcel.WriteInt32(resultInfo.GetIntValue("clirStat"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_CALL_SUPPLEMENT_REQUEST, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("update call event failed, error: %{public}d", error);
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
42
interfaces/innerkits/call_manager/proxy/call_ability_callback_proxy.h
Executable file
42
interfaces/innerkits/call_manager/proxy/call_ability_callback_proxy.h
Executable file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef CALL_ABILITY_CALLBACK_PROXY_H
|
||||
#define CALL_ABILITY_CALLBACK_PROXY_H
|
||||
|
||||
#include "iremote_proxy.h"
|
||||
|
||||
#include "i_call_ability_callback.h"
|
||||
#include "telephony_log_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class CallAbilityCallbackProxy : public IRemoteProxy<ICallAbilityCallback> {
|
||||
public:
|
||||
explicit CallAbilityCallbackProxy(const sptr<IRemoteObject> &impl);
|
||||
virtual ~CallAbilityCallbackProxy() = default;
|
||||
|
||||
int32_t OnCallDetailsChange(const CallAttributeInfo &info) override;
|
||||
int32_t OnCallEventChange(const CallEventInfo &info) override;
|
||||
int32_t OnSupplementResult(CallResultReportId reportId, AppExecFwk::PacMap &resultInfo) override;
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<CallAbilityCallbackProxy> delegator_;
|
||||
static constexpr HiviewDFX::HiLogLabel LOG_LABEL = {LOG_CORE, LOG_DOMAIN, "CallManager"};
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif
|
@ -16,7 +16,7 @@
|
||||
#include "call_manager_death_recipient.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
namespace Telephony {
|
||||
CallManagerDeathRecipient::CallManagerDeathRecipient(
|
||||
const std::function<void(const wptr<IRemoteObject> &object)> &deathCallback)
|
||||
: deathCallback_(deathCallback)
|
||||
@ -28,5 +28,5 @@ void CallManagerDeathRecipient::OnRemoteDied(const OHOS::wptr<OHOS::IRemoteObjec
|
||||
deathCallback_(object);
|
||||
}
|
||||
}
|
||||
} // namespace TelephonyCallManager
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
@ -15,10 +15,11 @@
|
||||
|
||||
#ifndef CALL_MANAGER_DEATH_RECIPIENT_H
|
||||
#define CALL_MANAGER_DEATH_RECIPIENT_H
|
||||
|
||||
#include "iremote_broker.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
namespace Telephony {
|
||||
class CallManagerDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
public:
|
||||
explicit CallManagerDeathRecipient(const std::function<void(const wptr<IRemoteObject> &object)> &deathCallback);
|
||||
@ -28,6 +29,7 @@ public:
|
||||
private:
|
||||
std::function<void(const wptr<IRemoteObject> &object)> deathCallback_;
|
||||
};
|
||||
} // namespace TelephonyCallManager
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // CALL_MANAGER_DEATH_RECIPIENT_H
|
||||
|
@ -19,146 +19,644 @@
|
||||
#include "message_parcel.h"
|
||||
|
||||
#include "call_manager_errors.h"
|
||||
#include "call_manager_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
namespace Telephony {
|
||||
CallManagerServiceProxy::CallManagerServiceProxy(const sptr<IRemoteObject> &impl)
|
||||
: IRemoteProxy<ICallManagerService>(impl)
|
||||
{}
|
||||
|
||||
int32_t CallManagerServiceProxy::DialCall(std::u16string number, AppExecFwk::PacMap &extras, int32_t &callId)
|
||||
int32_t CallManagerServiceProxy::RegisterCallBack(const sptr<ICallAbilityCallback> &callback)
|
||||
{
|
||||
int32_t error = TELEPHONY_REGISTER_CALLBACK_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteRemoteObject(callback->AsObject().GetRefPtr());
|
||||
error = Remote()->SendRequest(INTERFACE_REGISTER_CALLBACK, dataParcel, replyParcel, option);
|
||||
TELEPHONY_LOGD("error = %{public}d", error);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function RegisterCallBack! errCode:%{public}d", error);
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
return replyParcel.ReadInt32();
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::DialCall(std::u16string number, AppExecFwk::PacMap &extras)
|
||||
{
|
||||
CALLMANAGER_DEBUG_LOG("CallManagerServiceProxy::DialCall Enter --> ");
|
||||
int32_t error = CALL_MANAGER_DIAL_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
CALLMANAGER_ERR_LOG("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DISCRIPTOR_TOKEN_FAIL;
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
callId = TELEPHONY_NO_ERROR;
|
||||
dataParcel.WriteString16(number);
|
||||
int32_t accountId = extras.GetIntValue("accountId");
|
||||
int32_t videoState = extras.GetIntValue("vedioState");
|
||||
int32_t videoState = extras.GetIntValue("videoState");
|
||||
int32_t dialScene = extras.GetIntValue("dialScene");
|
||||
int32_t dialType = extras.GetIntValue("dialType");
|
||||
dataParcel.WriteInt32(accountId);
|
||||
dataParcel.WriteInt32(videoState);
|
||||
dataParcel.WriteInt32(dialScene);
|
||||
dataParcel.WriteInt32(dialType);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_DIAL_CALL, dataParcel, replyParcel, option);
|
||||
CALLMANAGER_DEBUG_LOG("error = %{public}d", error);
|
||||
if (error != TELEPHONY_NO_ERROR) {
|
||||
CALLMANAGER_DEBUG_LOG("Function DialCall call failed!");
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("function DialCall call failed!");
|
||||
return error;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
callId = replyParcel.ReadInt32();
|
||||
if (callId == TELEPHONY_NO_ERROR) {
|
||||
CALLMANAGER_DEBUG_LOG("Function DialCall call failed!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
CALLMANAGER_DEBUG_LOG("get callId from call manager server, callId = %{public}d", callId);
|
||||
CALLMANAGER_DEBUG_LOG("Leave");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::AcceptCall(int32_t callId, int32_t videoState)
|
||||
int32_t CallManagerServiceProxy::AnswerCall(int32_t callId, int32_t videoState)
|
||||
{
|
||||
CALLMANAGER_DEBUG_LOG("CallManagerServiceProxy::AcceptCall Enter -->");
|
||||
int32_t error = CALL_MANAGER_ACCPET_FAILED;
|
||||
int32_t error = CALL_MANAGER_ACCEPT_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
CALLMANAGER_ERR_LOG("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DISCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
|
||||
if (videoState != 0 && videoState != 1) {
|
||||
return CALL_MANAGER_VIDEO_MODE_ERR;
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
dataParcel.WriteInt32(videoState);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_ANSWER_CALL, dataParcel, replyParcel, option);
|
||||
CALLMANAGER_DEBUG_LOG("error = %{public}d", error);
|
||||
if (error != TELEPHONY_NO_ERROR) {
|
||||
CALLMANAGER_DEBUG_LOG("Function AcceptCall call failed! errCode:%{public}d", error);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("function AnswerCall call failed! errCode:%{public}d", error);
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
CALLMANAGER_DEBUG_LOG("Leave");
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::RejectCall(int32_t callId, bool isSendSms, std::u16string content)
|
||||
int32_t CallManagerServiceProxy::RejectCall(int32_t callId, bool rejectWithMessage, std::u16string textMessage)
|
||||
{
|
||||
CALLMANAGER_DEBUG_LOG("CallManagerServiceProxy::RejectCall Enter --> ");
|
||||
int32_t error = CALL_MANAGER_REJECT_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
CALLMANAGER_ERR_LOG("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DISCRIPTOR_TOKEN_FAIL;
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
|
||||
dataParcel.WriteInt32(callId);
|
||||
dataParcel.WriteBool(isSendSms);
|
||||
dataParcel.WriteString16(content);
|
||||
dataParcel.WriteBool(rejectWithMessage);
|
||||
dataParcel.WriteString16(textMessage);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_REJECT_CALL, dataParcel, replyParcel, option);
|
||||
CALLMANAGER_DEBUG_LOG("error = %{public}d", error);
|
||||
if (error != TELEPHONY_NO_ERROR) {
|
||||
CALLMANAGER_DEBUG_LOG("Function RejectCall call failed! errCode:%{public}d", error);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("function RejectCall call failed! errCode:%{public}d", error);
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
CALLMANAGER_DEBUG_LOG("Leave");
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::HangUpCall(int32_t callId)
|
||||
{
|
||||
CALLMANAGER_DEBUG_LOG("CallManagerServiceProxy::HangUpCall Enter -->");
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
CALLMANAGER_ERR_LOG("write descriptor fail");
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_DISCONNECT_CALL, dataParcel, replyParcel, option);
|
||||
CALLMANAGER_DEBUG_LOG("error = %{public}d", error);
|
||||
if (error != TELEPHONY_NO_ERROR) {
|
||||
CALLMANAGER_DEBUG_LOG("Function HangUpCall call failed! errCode:%{public}d", error);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("function HangUpCall call failed! errCode:%{public}d", error);
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
CALLMANAGER_DEBUG_LOG("Leave");
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::GetCallState()
|
||||
{
|
||||
CALLMANAGER_DEBUG_LOG("CallManagerServiceProxy::GetCallState Enter -->");
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
CALLMANAGER_ERR_LOG("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DISCRIPTOR_TOKEN_FAIL;
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
|
||||
error = Remote()->SendRequest(INTERFACE_GET_CALL_STATE, dataParcel, replyParcel, option);
|
||||
CALLMANAGER_DEBUG_LOG("error = %{public}d", error);
|
||||
if (error != TELEPHONY_NO_ERROR) {
|
||||
CALLMANAGER_DEBUG_LOG("Function GetCallState! errCode:%{public}d", error);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_GET_CALL_STATE, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("function GetCallState! errCode:%{public}d", error);
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
CALLMANAGER_DEBUG_LOG("Leave");
|
||||
return replyParcel.ReadInt32();
|
||||
}
|
||||
} // namespace TelephonyCallManager
|
||||
|
||||
int32_t CallManagerServiceProxy::HoldCall(int32_t callId)
|
||||
{
|
||||
int32_t error = CALL_MANAGER_HOLD_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_HOLD_CALL, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function HoldCall call failed! errCode:%{public}d", error);
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::UnHoldCall(int32_t callId)
|
||||
{
|
||||
int32_t error = CALL_MANAGER_UNHOLD_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_UNHOLD_CALL, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function UnHoldCall call failed! errCode:%{public}d", error);
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::SwitchCall(int32_t callId)
|
||||
{
|
||||
int32_t error = CALL_MANAGER_SWAP_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_SWAP_CALL, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function UnHoldCall call failed! errCode:%{public}d", error);
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
bool CallManagerServiceProxy::HasCall()
|
||||
{
|
||||
int error = TELEPHONY_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return false;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return false;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_HAS_CALL, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function SetAudioDevice! errCode:%{public}d", error);
|
||||
return false;
|
||||
}
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
bool CallManagerServiceProxy::IsNewCallAllowed()
|
||||
{
|
||||
int error = TELEPHONY_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return false;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return false;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_IS_NEW_CALL_ALLOWED, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function SetAudioDevice! errCode:%{public}d", error);
|
||||
return false;
|
||||
}
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
bool CallManagerServiceProxy::IsRinging()
|
||||
{
|
||||
int32_t error = CALL_MANAGER_GET_IS_RINGING_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return false;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return false;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_IS_RINGING, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("function IsRinging errCode:%{public}d", error);
|
||||
return false;
|
||||
}
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
bool CallManagerServiceProxy::IsInEmergencyCall()
|
||||
{
|
||||
int32_t error = CALL_MANAGER_GET_IS_RINGING_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return false;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return false;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_IS_EMERGENCY_CALL, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("function IsInEmergencyCall errCode:%{public}d", error);
|
||||
return false;
|
||||
}
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::StartDtmf(int32_t callId, char str)
|
||||
{
|
||||
int32_t error = CALL_MANAGER_START_DTMF_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
dataParcel.WriteInt8(str);
|
||||
error = Remote()->SendRequest(
|
||||
TelephonyCallManagerSurfaceCode::INTERFACE_START_DTMF, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function StartDtmf! errCode:%{public}d", error);
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::SendDtmf(int32_t callId, char str)
|
||||
{
|
||||
int32_t error = CALL_MANAGER_SEND_DTMF_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
dataParcel.WriteInt8(str);
|
||||
error = Remote()->SendRequest(
|
||||
TelephonyCallManagerSurfaceCode::INTERFACE_SEND_DTMF, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function SendDtmf! errCode:%{public}d", error);
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::SendBurstDtmf(int32_t callId, std::u16string str, int32_t on, int32_t off)
|
||||
{
|
||||
int32_t error = CALL_MANAGER_SEND_DTMF_BUNCH_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
dataParcel.WriteString16(str);
|
||||
dataParcel.WriteInt32(on);
|
||||
dataParcel.WriteInt32(off);
|
||||
error = Remote()->SendRequest(
|
||||
TelephonyCallManagerSurfaceCode::INTERFACE_SEND_DTMF_BUNCH, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function SendBurstDtmf! errCode:%{public}d", error);
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::StopDtmf(int32_t callId)
|
||||
{
|
||||
int32_t error = CALL_MANAGER_STOP_DTMF_FAILED;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
error = Remote()->SendRequest(
|
||||
TelephonyCallManagerSurfaceCode::INTERFACE_STOP_DTMF, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function StopDtmf! errCode:%{public}d", error);
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::GetCallWaiting(int32_t slotId)
|
||||
{
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(slotId);
|
||||
error = Remote()->SendRequest(
|
||||
TelephonyCallManagerSurfaceCode::INTERFACE_GET_CALL_WAITING, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function GetCallWaiting! errCode:%{public}d", error);
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::SetCallWaiting(int32_t slotId, bool activate)
|
||||
{
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(slotId);
|
||||
dataParcel.WriteBool(activate);
|
||||
error = Remote()->SendRequest(
|
||||
TelephonyCallManagerSurfaceCode::INTERFACE_SET_CALL_WAITING, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function SetCallWaiting! errCode:%{public}d", error);
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::CombineConference(int32_t mainCallId)
|
||||
{
|
||||
TELEPHONY_LOGD("Enter");
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(mainCallId);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_COMBINE_CONFERENCE, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function CombineConference failed! errCode:%{public}d", error);
|
||||
}
|
||||
TELEPHONY_LOGD("Leave");
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
bool CallManagerServiceProxy::IsEmergencyPhoneNumber(std::u16string &number, int32_t slotId)
|
||||
{
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteString16(number);
|
||||
dataParcel.WriteInt32(slotId);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return false;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_IS_EMERGENCY_NUMBER, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function IsEmergencyPhoneNumber call failed! errCode:%{public}d", error);
|
||||
}
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::FormatPhoneNumber(
|
||||
std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber)
|
||||
{
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteString16(number);
|
||||
dataParcel.WriteString16(countryCode);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_IS_FORMAT_NUMBER, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function FormatPhoneNumber call failed! errCode:%{public}d", error);
|
||||
}
|
||||
formatNumber = replyParcel.ReadString16();
|
||||
return replyParcel.ReadInt32();
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::FormatPhoneNumberToE164(
|
||||
std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber)
|
||||
{
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteString16(number);
|
||||
dataParcel.WriteString16(countryCode);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_IS_FORMAT_NUMBER_E164, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function FormatPhoneNumberToE164 call failed! errCode:%{public}d", error);
|
||||
}
|
||||
formatNumber = replyParcel.ReadString16();
|
||||
return replyParcel.ReadInt32();
|
||||
}
|
||||
|
||||
int32_t CallManagerServiceProxy::GetMainCallId(int32_t callId)
|
||||
{
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_GET_MAINID, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function StartConference call failed! errCode:%{public}d", error);
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
if (error == TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("function GetMainCallId call failed!");
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
std::vector<std::u16string> CallManagerServiceProxy::GetSubCallIdList(int32_t callId)
|
||||
{
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
std::vector<std::u16string> list;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return list;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return list;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_GET_SUBCALL_LIST_ID, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function GetSubCallIdList call failed! errCode:%{public}d", error);
|
||||
}
|
||||
replyParcel.ReadString16Vector(&list);
|
||||
return list;
|
||||
}
|
||||
|
||||
std::vector<std::u16string> CallManagerServiceProxy::GetCallIdListForConference(int32_t callId)
|
||||
{
|
||||
int32_t error = TELEPHONY_FAIL;
|
||||
std::vector<std::u16string> list;
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
|
||||
TELEPHONY_LOGE("write descriptor fail");
|
||||
return list;
|
||||
}
|
||||
dataParcel.WriteInt32(callId);
|
||||
if (Remote() == nullptr) {
|
||||
TELEPHONY_LOGE("function Remote() return nullptr!");
|
||||
return list;
|
||||
}
|
||||
error = Remote()->SendRequest(INTERFACE_GET_CALL_LIST_ID_FOR_CONFERENCE, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
TELEPHONY_LOGE("Function GetCallIdListForConference call failed! errCode:%{public}d", error);
|
||||
}
|
||||
replyParcel.ReadString16Vector(&list);
|
||||
return list;
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -15,6 +15,7 @@
|
||||
|
||||
#ifndef CALL_MANAGER_SERVICE_PROXY_H
|
||||
#define CALL_MANAGER_SERVICE_PROXY_H
|
||||
|
||||
#include <cfloat>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
@ -24,12 +25,13 @@
|
||||
#include "iremote_proxy.h"
|
||||
#include "pac_map.h"
|
||||
|
||||
#include "call_manager_type.h"
|
||||
#include "call_types.h"
|
||||
#include "call_manager_inner_type.h"
|
||||
#include "cellular_call_types.h"
|
||||
#include "i_call_manager_service.h"
|
||||
#include "telephony_log_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
namespace Telephony {
|
||||
class CallManagerServiceProxy : public IRemoteProxy<ICallManagerService> {
|
||||
public:
|
||||
/**
|
||||
@ -41,39 +43,46 @@ public:
|
||||
virtual ~CallManagerServiceProxy() = default;
|
||||
|
||||
/**
|
||||
* Call diale interface
|
||||
* register callback
|
||||
*
|
||||
* @param callback[in], callback function pointer
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int32_t RegisterCallBack(const sptr<ICallAbilityCallback> &callback) override;
|
||||
|
||||
/**
|
||||
* Call dial interface
|
||||
*
|
||||
* @param number[in], dial param.
|
||||
* @param extras[in], extras date.
|
||||
* @param callId[out], call id.
|
||||
* @return Returns callId when the value is greater than zero, others on failure.
|
||||
*/
|
||||
int32_t DialCall(std::u16string number, AppExecFwk::PacMap &extras, int32_t &callId) override;
|
||||
int32_t DialCall(std::u16string number, AppExecFwk::PacMap &extras) override;
|
||||
|
||||
/**
|
||||
* Answer call
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @param videoState[in], 0: audio, 1: video
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int32_t AcceptCall(int32_t callId, int32_t videoState) override;
|
||||
int32_t AnswerCall(int32_t callId, int32_t videoState) override;
|
||||
|
||||
/**
|
||||
* Reject call
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @param isSendSms[in], Whether to enter the reason for rejection,true:yes false:no
|
||||
* @param content[in], The reason you reject the call
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @param rejectWithMessage[in], Whether to enter the reason for rejection,true:yes false:no
|
||||
* @param textMessage[in], The reason you reject the call
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int32_t RejectCall(int32_t callId, bool isSendSms, std::u16string content) override;
|
||||
int32_t RejectCall(int32_t callId, bool rejectWithMessage, std::u16string textMessage) override;
|
||||
|
||||
/**
|
||||
* Disconnect call
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int32_t HangUpCall(int32_t callId) override;
|
||||
|
||||
@ -84,9 +93,132 @@ public:
|
||||
*/
|
||||
int32_t GetCallState() override;
|
||||
|
||||
/**
|
||||
* Hold call
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int32_t HoldCall(int32_t callId) override;
|
||||
|
||||
/**
|
||||
* UnHold call
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int32_t UnHoldCall(int32_t callId) override;
|
||||
|
||||
/**
|
||||
* Switch call
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int32_t SwitchCall(int32_t callId) override;
|
||||
|
||||
/**
|
||||
* Is there Call
|
||||
*
|
||||
* @return Returns TELEPHONY_SUCCESS on has call, others on there is no call.
|
||||
*/
|
||||
bool HasCall() override;
|
||||
|
||||
/**
|
||||
* Can I initiate a call
|
||||
*
|
||||
* @return Returns TELEPHONY_SUCCESS on can, others on there is not can.
|
||||
*/
|
||||
bool IsNewCallAllowed() override;
|
||||
|
||||
/**
|
||||
* Get ringing state
|
||||
*
|
||||
* @return Returns ringing state.
|
||||
*/
|
||||
bool IsRinging() override;
|
||||
|
||||
/**
|
||||
* Is there an emergency call
|
||||
*
|
||||
* @return Returns ture on Emergency call, false on No emergency call.
|
||||
*/
|
||||
bool IsInEmergencyCall() override;
|
||||
|
||||
/**
|
||||
* Start dtmf
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @param str[in], Characters sent
|
||||
* @return Returns 0 on success, others on failure.
|
||||
*/
|
||||
int32_t StartDtmf(int32_t callId, char str) override;
|
||||
|
||||
/**
|
||||
* Send dtmf
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @param str[in], Characters sent
|
||||
* @return Returns 0 on success, others on failure.
|
||||
*/
|
||||
int32_t SendDtmf(int32_t callId, char str) override;
|
||||
|
||||
/**
|
||||
* Stop dtmf
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @return Returns 0 on success, others on failure.
|
||||
*/
|
||||
int32_t StopDtmf(int32_t callId) override;
|
||||
|
||||
/**
|
||||
* Send dtmf string
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @param str[in], String sent
|
||||
* @param on DTMF pulse width, the unit is milliseconds, default is 0.
|
||||
* @param off DTMF pulse interval, the unit is milliseconds, default is 0.
|
||||
* @return Returns 0 on success, others on failure.
|
||||
*/
|
||||
int32_t SendBurstDtmf(int32_t callId, std::u16string str, int32_t on, int32_t off) override;
|
||||
|
||||
/**
|
||||
* Get Call Waiting
|
||||
* @param slotId
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int32_t GetCallWaiting(int32_t slotId) override;
|
||||
|
||||
/**
|
||||
* Set Call Waiting
|
||||
* @param slotId
|
||||
* @param activate
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int32_t SetCallWaiting(int32_t slotId, bool activate) override;
|
||||
|
||||
/**
|
||||
* CombineConference
|
||||
*
|
||||
* @param callId[in], call id
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int32_t CombineConference(int32_t mainCallId) override;
|
||||
|
||||
bool IsEmergencyPhoneNumber(std::u16string &number, int32_t slotId) override;
|
||||
int32_t FormatPhoneNumber(
|
||||
std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber) override;
|
||||
int32_t FormatPhoneNumberToE164(
|
||||
std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber) override;
|
||||
int32_t GetMainCallId(int32_t callId) override;
|
||||
std::vector<std::u16string> GetSubCallIdList(int32_t callId) override;
|
||||
std::vector<std::u16string> GetCallIdListForConference(int32_t callId) override;
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<CallManagerServiceProxy> delegator_;
|
||||
static constexpr HiviewDFX::HiLogLabel LOG_LABEL = {LOG_CORE, LOG_DOMAIN, "CallManager"};
|
||||
};
|
||||
} // namespace TelephonyCallManager
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // CALL_MANAGER_SERVICE_PROXY_H
|
@ -14,36 +14,37 @@
|
||||
*/
|
||||
|
||||
#include "call_status_callback_proxy.h"
|
||||
#include "call_manager_errors.h"
|
||||
|
||||
#include "message_option.h"
|
||||
#include "message_parcel.h"
|
||||
|
||||
#include "call_manager_log.h"
|
||||
#include "telephony_log_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
namespace Telephony {
|
||||
CallStatusCallbackProxy::CallStatusCallbackProxy(const sptr<IRemoteObject> &impl)
|
||||
: IRemoteProxy<ICallStatusCallback>(impl)
|
||||
{}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateCallReportInfo(const CallReportInfo &info)
|
||||
{
|
||||
CALLMANAGER_ERR_LOG("CallStatusCallbackProxy::OnUpdateCallReportInfo Enter -->");
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int error = -1;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
CALLMANAGER_ERR_LOG("write descriptor fail");
|
||||
return -1;
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
int32_t length = sizeof(CallReportInfo);
|
||||
dataParcel.WriteInt32(length);
|
||||
dataParcel.WriteRawData((const void *)&info, length);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_CALL_INFO, dataParcel, replyParcel, option);
|
||||
if (error != 0) {
|
||||
CALLMANAGER_ERR_LOG("update cellular call info failed, error: %{public}d", error);
|
||||
return -1;
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
@ -51,37 +52,258 @@ int32_t CallStatusCallbackProxy::OnUpdateCallReportInfo(const CallReportInfo &in
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateCallsReportInfo(const CallsReportInfo &info)
|
||||
{
|
||||
CALLMANAGER_ERR_LOG("CallStatusCallbackProxy::OnUpdateCallsReportInfo Enter -->");
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t length = sizeof(CallReportInfo);
|
||||
int error = -1;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
CALLMANAGER_ERR_LOG("write descriptor fail");
|
||||
return -1;
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(info.callVec.size());
|
||||
for (auto &it : info.callVec) {
|
||||
dataParcel.WriteInt32(length);
|
||||
dataParcel.WriteRawData((const void *)&it, length);
|
||||
CALLMANAGER_DEBUG_LOG(
|
||||
"accountId:%{public}d,callType:%{public}d,state:%{public}d\n", it.accountId, it.callType, it.state);
|
||||
}
|
||||
dataParcel.WriteInt32(info.slotId);
|
||||
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_CALLS_INFO, dataParcel, replyParcel, option);
|
||||
if (error != 0) {
|
||||
CALLMANAGER_ERR_LOG("update cellular cs call info failed, error: %{public}d", error);
|
||||
return -1;
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateDisconnectedCause(const DisconnectedDetails &)
|
||||
int32_t CallStatusCallbackProxy::OnUpdateDisconnectedCause(const DisconnectedDetails &cause)
|
||||
{
|
||||
return 0;
|
||||
return TELEPHONY_SUCCESS;
|
||||
}
|
||||
} // namespace TelephonyCallManager
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateEventResultInfo(const CellularCallEventInfo &info)
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
int32_t length = sizeof(CellularCallEventInfo);
|
||||
dataParcel.WriteInt32(length);
|
||||
dataParcel.WriteRawData((const void *)&info, length);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_EVENT_RESULT_INFO, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateGetWaitingResult(const CallWaitResponse &callWaitResponse)
|
||||
{
|
||||
TELEPHONY_LOGE("OnUpdateGetWaitingResult on");
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
int32_t length = sizeof(CallWaitResponse);
|
||||
dataParcel.WriteInt32(length);
|
||||
dataParcel.WriteRawData((const void *)&callWaitResponse, length);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_GET_WAITING, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateSetWaitingResult(int32_t result)
|
||||
{
|
||||
TELEPHONY_LOGE("OnUpdateSetWaitingResult on");
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(result);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_SET_WAITING, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateGetRestrictionResult(const CallRestrictionResponse &callLimitResult)
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
int32_t length = sizeof(CallRestrictionResponse);
|
||||
dataParcel.WriteInt32(length);
|
||||
dataParcel.WriteRawData((const void *)&callLimitResult, length);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_GET_RESTRICTION, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateSetRestrictionResult(int32_t result)
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(result);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_SET_RESTRICTION, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateGetTransferResult(const CallTransferResponse &callTransferResponse)
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
int32_t length = sizeof(CallTransferResponse);
|
||||
dataParcel.WriteInt32(length);
|
||||
dataParcel.WriteRawData((const void *)&callTransferResponse, length);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_GET_TRANSFER, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateSetTransferResult(int32_t result)
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(result);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_SET_TRANSFER, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateGetCallClipResult(const ClipResponse &clipResponse)
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
int32_t length = sizeof(ClipResponse);
|
||||
dataParcel.WriteInt32(length);
|
||||
dataParcel.WriteRawData((const void *)&clipResponse, length);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_GET_CALL_CLIP, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateGetCallClirResult(const ClirResponse &clirResponse)
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
int32_t length = sizeof(ClirResponse);
|
||||
dataParcel.WriteInt32(length);
|
||||
dataParcel.WriteRawData((const void *)&clirResponse, length);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_GET_CALL_CLIR, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CallStatusCallbackProxy::OnUpdateSetCallClirResult(int32_t result)
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
int32_t error = CALL_MANAGER_HANGUP_FAILED;
|
||||
if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
|
||||
return TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL;
|
||||
}
|
||||
dataParcel.WriteInt32(result);
|
||||
if (Remote() == nullptr) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = Remote()->SendRequest(UPDATE_SET_CALL_CLIR, dataParcel, replyParcel, option);
|
||||
if (error != TELEPHONY_SUCCESS) {
|
||||
return TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL;
|
||||
}
|
||||
error = replyParcel.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
@ -15,24 +15,35 @@
|
||||
|
||||
#ifndef CALL_STATUS_CALLBACK_PROXY_H
|
||||
#define CALL_STATUS_CALLBACK_PROXY_H
|
||||
|
||||
#include "iremote_proxy.h"
|
||||
#include "i_call_status_callback.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
namespace Telephony {
|
||||
class CallStatusCallbackProxy : public IRemoteProxy<ICallStatusCallback> {
|
||||
public:
|
||||
explicit CallStatusCallbackProxy(const sptr<IRemoteObject> &impl);
|
||||
|
||||
virtual ~CallStatusCallbackProxy() = default;
|
||||
|
||||
int32_t OnUpdateCallReportInfo(const CallReportInfo &info) override;
|
||||
int32_t OnUpdateCallsReportInfo(const CallsReportInfo &info) override;
|
||||
int32_t OnUpdateDisconnectedCause(const DisconnectedDetails &cause) override;
|
||||
int32_t OnUpdateEventResultInfo(const CellularCallEventInfo &info) override;
|
||||
int32_t OnUpdateGetWaitingResult(const CallWaitResponse &callWaitResponse) override;
|
||||
int32_t OnUpdateSetWaitingResult(int32_t result) override;
|
||||
int32_t OnUpdateGetRestrictionResult(const CallRestrictionResponse &callLimitResult) override;
|
||||
int32_t OnUpdateSetRestrictionResult(int32_t result) override;
|
||||
int32_t OnUpdateGetTransferResult(const CallTransferResponse &callTransferResponse) override;
|
||||
int32_t OnUpdateSetTransferResult(int32_t result) override;
|
||||
int32_t OnUpdateGetCallClipResult(const ClipResponse &clipResponse) override;
|
||||
int32_t OnUpdateGetCallClirResult(const ClirResponse &clirResponse) override;
|
||||
int32_t OnUpdateSetCallClirResult(int32_t result) override;
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<CallStatusCallbackProxy> delegator_;
|
||||
};
|
||||
} // namespace TelephonyCallManager
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "cellular_call_callback_death_recipient.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
namespace Telephony {
|
||||
CellularCallCallbackDeathRecipient::CellularCallCallbackDeathRecipient(
|
||||
const std::function<void(const wptr<IRemoteObject> &object)> &deathCallback)
|
||||
: deathCallback_(deathCallback)
|
||||
@ -28,5 +28,5 @@ void CellularCallCallbackDeathRecipient::OnRemoteDied(const OHOS::wptr<OHOS::IRe
|
||||
deathCallback_(object);
|
||||
}
|
||||
}
|
||||
} // namespace TelephonyCallManager
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -15,15 +15,15 @@
|
||||
|
||||
#ifndef CELLULAR_CALL_CALLBACK_DEATH_RECIPIENT_H
|
||||
#define CELLULAR_CALL_CALLBACK_DEATH_RECIPIENT_H
|
||||
|
||||
#include "iremote_broker.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
namespace Telephony {
|
||||
class CellularCallCallbackDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
public:
|
||||
explicit CellularCallCallbackDeathRecipient(
|
||||
const std::function<void(const wptr<IRemoteObject> &object)> &deathCallback);
|
||||
|
||||
virtual ~CellularCallCallbackDeathRecipient() = default;
|
||||
|
||||
void OnRemoteDied(const wptr<IRemoteObject> &object) override;
|
||||
@ -31,6 +31,7 @@ public:
|
||||
private:
|
||||
std::function<void(const wptr<IRemoteObject> &object)> deathCallback_;
|
||||
};
|
||||
} // namespace TelephonyCallManager
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // CELLULAR_CALL_CALLBACK_DEATH_RECIPIENT_H
|
||||
|
46
interfaces/innerkits/call_manager/proxy/i_call_ability_callback.h
Executable file
46
interfaces/innerkits/call_manager/proxy/i_call_ability_callback.h
Executable file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef I_CALL_ABILITY_CALLBACK_H
|
||||
#define I_CALL_ABILITY_CALLBACK_H
|
||||
|
||||
#include "pac_map.h"
|
||||
#include "iremote_broker.h"
|
||||
|
||||
#include "call_manager_inner_type.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class ICallAbilityCallback : public IRemoteBroker {
|
||||
public:
|
||||
virtual ~ICallAbilityCallback() = default;
|
||||
|
||||
virtual int32_t OnCallDetailsChange(const CallAttributeInfo &info) = 0;
|
||||
virtual int32_t OnCallEventChange(const CallEventInfo &info) = 0;
|
||||
virtual int32_t OnSupplementResult(CallResultReportId reportId, AppExecFwk::PacMap &resultInfo) = 0;
|
||||
|
||||
enum TelephonyCallManagerAbilityCode {
|
||||
UPDATE_CALL_STATE_INFO = 0,
|
||||
UPDATE_CALL_EVENT,
|
||||
UPDATE_CALL_SUPPLEMENT_REQUEST,
|
||||
};
|
||||
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.ICallAbilityCallback");
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif
|
@ -15,6 +15,7 @@
|
||||
|
||||
#ifndef I_CALL_MANAGER_SERVICE_H
|
||||
#define I_CALL_MANAGER_SERVICE_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -22,74 +23,88 @@
|
||||
#include "iremote_broker.h"
|
||||
#include "pac_map.h"
|
||||
|
||||
#include "call_manager_type.h"
|
||||
#include "call_types.h"
|
||||
#include "call_manager_inner_type.h"
|
||||
#include "cellular_call_types.h"
|
||||
#include "i_call_ability_callback.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
namespace Telephony {
|
||||
extern "C" {
|
||||
enum TelephonyCallManagerSurfaceCode {
|
||||
INTERFACE_DIAL_CALL = 0,
|
||||
INTERFACE_REGISTER_CALLBACK = 0,
|
||||
INTERFACE_DIAL_CALL,
|
||||
INTERFACE_ANSWER_CALL,
|
||||
INTERFACE_REJECT_CALL,
|
||||
INTERFACE_HOLD_CALL,
|
||||
INTERFACE_UNHOLD_CALL,
|
||||
INTERFACE_DISCONNECT_CALL,
|
||||
INTERFACE_GET_CALL_STATE,
|
||||
INTERFACE_SWAP_CALL,
|
||||
INTERFACE_SEPARATE_CONFERENCE,
|
||||
INTERFACE_JOIN_CONFERENCE,
|
||||
INTERFACE_HAS_CALL,
|
||||
INTERFACE_IS_NEW_CALL_ALLOWED,
|
||||
INTERFACE_IS_RINGING,
|
||||
INTERFACE_IS_EMERGENCY_CALL,
|
||||
INTERFACE_IS_EMERGENCY_NUMBER,
|
||||
INTERFACE_IS_FORMAT_NUMBER,
|
||||
INTERFACE_IS_FORMAT_NUMBER_E164,
|
||||
INTERFACE_COMBINE_CONFERENCE,
|
||||
INTERFACE_GET_MAIN_CALL_ID,
|
||||
INTERFACE_GET_SUB_CALL_ID_LIST,
|
||||
INTERFACE_GET_CALL_ID_LIST_FOR_CONFERENCE,
|
||||
INTERFACE_GET_PREDEFINE_REJECT_MESSAGES,
|
||||
INTERFACE_GETTRANSFER_NUMBER,
|
||||
INTERFACE_SETTRANSFER_NUMBER,
|
||||
INTERFACE_INVITE_TO_CONFERENCE,
|
||||
INTERFACE_KICKOUT_FROM_CONFERENCE,
|
||||
INTERFACE_LEAVE_CONFERENCE,
|
||||
INTERFACE_UPGRADE_CALL,
|
||||
INTERFACE_DOWNGRADE_CALL,
|
||||
INTERFACE_SET_VOLTE,
|
||||
INTERFACE_SET_WIFICALLING,
|
||||
INTERFACE_SET_WIFICALLING_MODE,
|
||||
INTERFACE_SET_VOLTE_STRONG_MODE,
|
||||
INTERFACE_SEPARATE_CONFERENCE,
|
||||
INTERFACE_START_DTMF,
|
||||
INTERFACE_STOP_DTMF,
|
||||
INTERFACE_SEND_DTMF,
|
||||
INTERFACE_SEND_DTMF_BUNCH,
|
||||
INTERFACE_HAS_INCALL,
|
||||
INTERFACE_IS_NEW_CALL_ALLOWED,
|
||||
INTERFACE_MUTE_RINGING,
|
||||
INTERFACE_GET_CALL_STATE,
|
||||
INTERFACE_IS_RINGING,
|
||||
INTERFACE_IS_IN_EMERGENCY_CALL,
|
||||
INTERFACE_CANCEL_MISSED_CALLS_NOTIFICATION,
|
||||
INTERFACE_SET_AUDIO_ROUTE,
|
||||
INTERFACE_SET_MUTED,
|
||||
INTERFACE_IS_VIDEO_CALLING_ENABLED,
|
||||
INTERFACE_HAS_VOICE_CAPABILITY,
|
||||
INTERFACE_CTRL_CAMERA,
|
||||
INTERFACE_SET_PREVIEW_WINDOW,
|
||||
INTERFACE_SET_DISPLAY_WINDOW,
|
||||
INTERFACE_SET_CAMERA_ZOOM,
|
||||
INTERFACE_SET_PAUSE_IMAGE,
|
||||
INTERFACE_SET_DEV_DIRECTION,
|
||||
INTERFACE_GET_CALL_WAITING,
|
||||
INTERFACE_SET_CALL_WAITING,
|
||||
INTERFACE_GET_CALL_RESTRICTION,
|
||||
INTERFACE_SET_CALL_RESTRICTION,
|
||||
INTERFACE_GET_CALL_TRANSFER,
|
||||
INTERFACE_SET_CALL_TRANSFER,
|
||||
INTERFACE_GET_MAINID,
|
||||
INTERFACE_GET_SUBCALL_LIST_ID,
|
||||
INTERFACE_GET_CALL_LIST_ID_FOR_CONFERENCE,
|
||||
INTERFACE_SET_MUTE,
|
||||
INTERFACE_MUTE_RINGER,
|
||||
INTERFACE_SET_AUDIO_DEVICE,
|
||||
INTERFACE_PLAY_DTMF,
|
||||
};
|
||||
} // end extern
|
||||
|
||||
class ICallManagerService : public IRemoteBroker {
|
||||
public:
|
||||
virtual ~ICallManagerService() = default;
|
||||
virtual int32_t DialCall(std::u16string number, AppExecFwk::PacMap &extras, int32_t &callId) = 0;
|
||||
virtual int32_t AcceptCall(int32_t callId, int32_t videoState) = 0;
|
||||
virtual int32_t RejectCall(int32_t callId, bool isSendSms, std::u16string content) = 0;
|
||||
virtual int32_t RegisterCallBack(const sptr<ICallAbilityCallback> &callback) = 0;
|
||||
virtual int32_t DialCall(std::u16string number, AppExecFwk::PacMap &extras) = 0;
|
||||
virtual int32_t AnswerCall(int32_t callId, int32_t videoState) = 0;
|
||||
virtual int32_t RejectCall(int32_t callId, bool rejectWithMessage, std::u16string textMessage) = 0;
|
||||
virtual int32_t HangUpCall(int32_t callId) = 0;
|
||||
virtual int32_t GetCallState() = 0;
|
||||
virtual int32_t HoldCall(int32_t callId) = 0;
|
||||
virtual int32_t UnHoldCall(int32_t callId) = 0;
|
||||
virtual int32_t SwitchCall(int32_t callId) = 0;
|
||||
virtual bool HasCall() = 0;
|
||||
virtual bool IsNewCallAllowed() = 0;
|
||||
virtual bool IsRinging() = 0;
|
||||
virtual bool IsInEmergencyCall() = 0;
|
||||
virtual int32_t StartDtmf(int32_t callId, char str) = 0;
|
||||
virtual int32_t SendDtmf(int32_t callId, char str) = 0;
|
||||
virtual int32_t StopDtmf(int32_t callId) = 0;
|
||||
virtual int32_t SendBurstDtmf(int32_t callId, std::u16string str, int32_t on, int32_t off) = 0;
|
||||
virtual int32_t GetCallWaiting(int32_t slotId) = 0;
|
||||
virtual int32_t SetCallWaiting(int32_t slotId, bool activate) = 0;
|
||||
virtual int32_t CombineConference(int32_t mainCallId) = 0;
|
||||
virtual bool IsEmergencyPhoneNumber(std::u16string &number, int32_t slotId) = 0;
|
||||
virtual int32_t FormatPhoneNumber(
|
||||
std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber) = 0;
|
||||
virtual int32_t FormatPhoneNumberToE164(
|
||||
std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber) = 0;
|
||||
virtual int32_t GetMainCallId(int32_t callId) = 0;
|
||||
virtual std::vector<std::u16string> GetSubCallIdList(int32_t callId) = 0;
|
||||
virtual std::vector<std::u16string> GetCallIdListForConference(int32_t callId) = 0;
|
||||
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ipc.ITelephonyCallManagerService");
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.ICallManagerService");
|
||||
};
|
||||
} // namespace TelephonyCallManager
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // I_CALL_MANAGER_SERVICE_H
|
@ -15,11 +15,13 @@
|
||||
|
||||
#ifndef I_CALL_STATUS_CALLBACK_H
|
||||
#define I_CALL_STATUS_CALLBACK_H
|
||||
|
||||
#include "call_manager_inner_type.h"
|
||||
|
||||
#include "iremote_broker.h"
|
||||
#include "call_manager_type.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace TelephonyCallManager {
|
||||
namespace Telephony {
|
||||
class ICallStatusCallback : public IRemoteBroker {
|
||||
public:
|
||||
virtual ~ICallStatusCallback() = default;
|
||||
@ -27,16 +29,37 @@ public:
|
||||
virtual int32_t OnUpdateCallReportInfo(const CallReportInfo &info) = 0;
|
||||
virtual int32_t OnUpdateCallsReportInfo(const CallsReportInfo &info) = 0;
|
||||
virtual int32_t OnUpdateDisconnectedCause(const DisconnectedDetails &cause) = 0;
|
||||
virtual int32_t OnUpdateEventResultInfo(const CellularCallEventInfo &info) = 0;
|
||||
virtual int32_t OnUpdateGetWaitingResult(const CallWaitResponse &callWaitResponse) = 0;
|
||||
virtual int32_t OnUpdateSetWaitingResult(int32_t result) = 0;
|
||||
virtual int32_t OnUpdateGetRestrictionResult(const CallRestrictionResponse &callLimitResult) = 0;
|
||||
virtual int32_t OnUpdateSetRestrictionResult(int32_t result) = 0;
|
||||
virtual int32_t OnUpdateGetTransferResult(const CallTransferResponse &callTransferResponse) = 0;
|
||||
virtual int32_t OnUpdateSetTransferResult(int32_t result) = 0;
|
||||
virtual int32_t OnUpdateGetCallClipResult(const ClipResponse &clipResponse) = 0;
|
||||
virtual int32_t OnUpdateGetCallClirResult(const ClirResponse &clirResponse) = 0;
|
||||
virtual int32_t OnUpdateSetCallClirResult(int32_t result) = 0;
|
||||
|
||||
enum {
|
||||
enum TelephonyCallManagerUpdateCode {
|
||||
UPDATE_CALL_INFO = 0,
|
||||
UPDATE_CALLS_INFO,
|
||||
UPDATE_DISCONNECTED_CAUSE,
|
||||
UPDATE_EVENT_RESULT_INFO,
|
||||
UPDATE_GET_WAITING,
|
||||
UPDATE_SET_WAITING,
|
||||
UPDATE_GET_RESTRICTION,
|
||||
UPDATE_SET_RESTRICTION,
|
||||
UPDATE_GET_TRANSFER,
|
||||
UPDATE_SET_TRANSFER,
|
||||
UPDATE_GET_CALL_CLIP,
|
||||
UPDATE_GET_CALL_CLIR,
|
||||
UPDATE_SET_CALL_CLIR,
|
||||
};
|
||||
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.callManager.ICallStatusCallback");
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.ICallStatusCallback");
|
||||
};
|
||||
} // namespace TelephonyCallManager
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef CALL_TYPES_H
|
||||
#define CALL_TYPES_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
namespace OHOS {
|
||||
const int kMaxNumberLen = 30;
|
||||
|
||||
// call state
|
||||
enum TelCallStates {
|
||||
CALL_STATUS_ACTIVE = 0,
|
||||
CALL_STATUS_HOLDING,
|
||||
CALL_STATUS_DIALING,
|
||||
CALL_STATUS_ALERTING,
|
||||
CALL_STATUS_INCOMING,
|
||||
CALL_STATUS_WAITING,
|
||||
CALL_STATUS_DISCONNECTED,
|
||||
CALL_STATUS_DISCONNECTING,
|
||||
CALL_STATUS_IDLE,
|
||||
};
|
||||
|
||||
// call type
|
||||
enum CallType {
|
||||
TYPE_CS = 0, // CS
|
||||
TYPE_IMS = 1, // IMS
|
||||
TYPE_OTT = 2, // OTT
|
||||
TYPE_ERR_CALL = 3, // OTHER
|
||||
};
|
||||
|
||||
// phone type
|
||||
enum PhoneNetType {
|
||||
PHONE_TYPE_GSM = 1, // gsm
|
||||
PHONE_TYPE_CDMA = 2, // cdma
|
||||
};
|
||||
|
||||
// call mode
|
||||
enum class VedioStateType {
|
||||
TYPE_VOICE = 0, // Voice
|
||||
TYPE_VIDEO, // Video
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif
|
105
interfaces/innerkits/cellular_call/common/cellular_call_types.h
Executable file → Normal file
105
interfaces/innerkits/cellular_call/common/cellular_call_types.h
Executable file → Normal file
@ -17,25 +17,12 @@
|
||||
#define CELLULAR_CALL_CELLULAR_CALL_TYPES_H
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "call_types.h"
|
||||
#include "call_manager_errors.h"
|
||||
#include "call_manager_inner_type.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularCall {
|
||||
enum ErrorCode {
|
||||
ERR_PARAMETER_INVALID = 0x02 + 1, // parameter error or invalid
|
||||
ERR_CALL_STATE, // call state error
|
||||
ERR_RADIO_STATE, // Radio state error
|
||||
ERR_FDN_TYPE, // FDN type
|
||||
ERR_MMI_TYPE, // include:Supplementary Service、USSD
|
||||
ERR_SYSTEM_INVOKE, // Error calling standard system library function
|
||||
ERR_CONNECTION, // Connection is null
|
||||
ERR_RIL_MANAGER, // ril manager is nullptr
|
||||
ERR_GET_RADIO_STATE, // radio state error
|
||||
ERR_REPORT_CALLS_INFO, // report calls info error
|
||||
ERR_NETWORK_TYPE, // Network type error
|
||||
};
|
||||
/**************************common**********************************/
|
||||
namespace Telephony {
|
||||
const int32_t MAX_SIZE = 10;
|
||||
|
||||
/***********************down event**********************************/
|
||||
struct CellularCallInfo {
|
||||
@ -43,25 +30,83 @@ struct CellularCallInfo {
|
||||
char phoneNum[kMaxNumberLen]; // call phone number
|
||||
int32_t slotId; // del
|
||||
int32_t accountId;
|
||||
PhoneNetType phoneNetType; // 1: gsm 2: cdma
|
||||
CallType callType; // call type: CS、IMS
|
||||
int32_t videoState; // 0: audio 1:video
|
||||
int32_t index; // CallInfo index
|
||||
};
|
||||
|
||||
/*************************up event********************************/
|
||||
struct CellularCallReportInfo {
|
||||
char phoneNum[kMaxNumberLen]; // call phone number
|
||||
int32_t phoneId;
|
||||
CallType callType; // call type: CS、IMS
|
||||
VedioStateType callMode; // call mode: video or audio
|
||||
TelCallStates state;
|
||||
/**
|
||||
* 27007-430_2001 7.11 Call forwarding number and conditions +CCFC
|
||||
* 3GPP TS 22.082 [4]
|
||||
* <mode>:
|
||||
* 0 disable
|
||||
* 1 enable
|
||||
* 2 query status
|
||||
* 3 registration
|
||||
* 4 erasure
|
||||
*/
|
||||
enum CallTransferSettingType {
|
||||
DISABLE = 0,
|
||||
ENABLE = 1,
|
||||
QUERY_STATUS = 2,
|
||||
REGISTRATION = 3,
|
||||
ERASURE = 4,
|
||||
};
|
||||
|
||||
struct CellularCSCallResponseInfo {
|
||||
std::vector<CellularCallReportInfo> callVec;
|
||||
int32_t slotId;
|
||||
/**
|
||||
* 27007-430_2001 7.11 Call forwarding number and conditions +CCFC
|
||||
* 3GPP TS 22.082 [4]
|
||||
* <reason>:
|
||||
* 0 unconditional
|
||||
* 1 mobile busy
|
||||
* 2 no reply
|
||||
* 3 not reachable
|
||||
* 4 all call forwarding (refer 3GPP TS 22.030 [19])
|
||||
* 5 all conditional call forwarding (refer 3GPP TS 22.030 [19])
|
||||
*/
|
||||
enum CallTransferType {
|
||||
UNCONDITIONAL = 0,
|
||||
MOBILE_BUSY = 1,
|
||||
NO_REPLY = 2,
|
||||
NOT_REACHABLE = 3,
|
||||
};
|
||||
} // namespace CellularCall
|
||||
|
||||
struct CallTransferInfo {
|
||||
CallTransferSettingType settingType;
|
||||
CallTransferType type;
|
||||
char transferNum[kMaxNumberLen];
|
||||
};
|
||||
|
||||
// 3GPP TS 22.030 V4.0.0 (2001-03)
|
||||
// 3GPP TS 22.088 V4.0.0 (2001-03)
|
||||
enum CallRestrictionType {
|
||||
RESTRICTION_TYPE_ALL_OUTGOING = 0,
|
||||
RESTRICTION_TYPE_INTERNATIONAL = 1,
|
||||
RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME = 2,
|
||||
RESTRICTION_TYPE_ALL_INCOMING = 3,
|
||||
RESTRICTION_TYPE_ROAMING_INCOMING = 4,
|
||||
};
|
||||
|
||||
// 3GPP TS 22.088 V4.0.0 (2001-03)
|
||||
enum CallRestrictionMode {
|
||||
RESTRICTION_MODE_DEACTIVATION = 0,
|
||||
RESTRICTION_MODE_ACTIVATION = 1,
|
||||
RESTRICTION_MODE_QUERY = 2,
|
||||
};
|
||||
|
||||
struct CallRestrictionInfo {
|
||||
CallRestrictionType fac;
|
||||
CallRestrictionMode mode;
|
||||
char password[kMaxNumberLen];
|
||||
};
|
||||
|
||||
// 3GPP TS 27.007 V3.9.0 (2001-06) Call related supplementary services +CHLD
|
||||
// 3GPP TS 27.007 V3.9.0 (2001-06) 7.22 Informative examples
|
||||
enum CallSupplementType {
|
||||
TYPE_HANG_UP_HOLD_WAIT = 0, // release the held call and the wait call
|
||||
TYPE_HANG_UP_ACTIVE = 1, // release the active call and recover the held call
|
||||
TYPE_HANG_UP_ALL = 2, // release all calls
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // CELLULAR_CALL_CELLULAR_CALL_TYPES_H
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "cellular_call_death_recipient.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularCall {
|
||||
namespace Telephony {
|
||||
CellularCallDeathRecipient::CellularCallDeathRecipient(
|
||||
const std::function<void(const wptr<IRemoteObject> &object)> &deathCallback)
|
||||
: deathCallback_(deathCallback)
|
||||
@ -28,5 +28,5 @@ void CellularCallDeathRecipient::OnRemoteDied(const OHOS::wptr<OHOS::IRemoteObje
|
||||
deathCallback_(object);
|
||||
}
|
||||
}
|
||||
} // namespace CellularCall
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
@ -12,11 +12,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TELEPHONY_CELLULAR_CALL_DEATH_RECIPIENT_H
|
||||
#define TELEPHONY_CELLULAR_CALL_DEATH_RECIPIENT_H
|
||||
|
||||
#include "iremote_broker.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularCall {
|
||||
namespace Telephony {
|
||||
class CellularCallDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
public:
|
||||
explicit CellularCallDeathRecipient(
|
||||
@ -27,6 +30,6 @@ public:
|
||||
private:
|
||||
std::function<void(const wptr<IRemoteObject> &object)> deathCallback_;
|
||||
};
|
||||
} // namespace CellularCall
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // TELEPHONY_CELLULAR_CALL_DEATH_RECIPIENT_H
|
||||
|
186
interfaces/innerkits/cellular_call/proxy/cellular_call_interface.h
Executable file → Normal file
186
interfaces/innerkits/cellular_call/proxy/cellular_call_interface.h
Executable file → Normal file
@ -15,11 +15,12 @@
|
||||
|
||||
#ifndef CELLULAR_CALL_INTERFACE_H
|
||||
#define CELLULAR_CALL_INTERFACE_H
|
||||
|
||||
#include "cellular_call_types.h"
|
||||
#include "i_call_status_callback.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularCall {
|
||||
namespace Telephony {
|
||||
class CellularCallInterface : public IRemoteBroker {
|
||||
public:
|
||||
// operation type
|
||||
@ -28,66 +29,207 @@ public:
|
||||
END = 2,
|
||||
REJECT = 3,
|
||||
ANSWER = 4,
|
||||
EMERGENCY_CALL = 5,
|
||||
REGISTER_CALLBACK = 6,
|
||||
UNREGISTER_CALLBACK = 7,
|
||||
HOLD = 5,
|
||||
ACTIVE = 6,
|
||||
SWAP = 7,
|
||||
URGENT_CALL = 8,
|
||||
JOIN = 9,
|
||||
SPLIT = 10,
|
||||
INITIATE_DTMF = 11,
|
||||
CEASE_DTMF = 12,
|
||||
TRANSMIT_DTMF = 13,
|
||||
TRANSMIT_DTMF_STRING = 14,
|
||||
SET_CALL_TRANSFER = 15,
|
||||
INQUIRE_CALL_TRANSFER = 16,
|
||||
SET_CALL_WAITING = 17,
|
||||
INQUIRE_CALL_WAITING = 18,
|
||||
SET_CALL_RESTRICTION = 19,
|
||||
INQUIRE_CALL_RESTRICTION = 20,
|
||||
REGISTER_CALLBACK = 21,
|
||||
UNREGISTER_CALLBACK = 22,
|
||||
CALL_SUPPLEMENT = 23,
|
||||
};
|
||||
|
||||
/**
|
||||
* Call management dial interface
|
||||
*
|
||||
* @param CellularCall, dial param.
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
virtual int Dial(const CellularCallInfo &dialInfo) = 0;
|
||||
virtual int Dial(const CellularCallInfo &callInfo) = 0;
|
||||
|
||||
/**
|
||||
* End.
|
||||
*
|
||||
* @param CallInfo, End param.
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
virtual int End(const CellularCallInfo &dialInfo) = 0;
|
||||
virtual int End(const CellularCallInfo &callInfo) = 0;
|
||||
|
||||
/**
|
||||
* Answer.
|
||||
*
|
||||
* @param CallInfo, Answer param.
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
virtual int Answer(const CellularCallInfo &dialInfo) = 0;
|
||||
virtual int Answer(const CellularCallInfo &callInfo) = 0;
|
||||
|
||||
/**
|
||||
* Reject.
|
||||
*
|
||||
* @param CallInfo, Reject param.
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
virtual int Reject(const CellularCallInfo &dialInfo) = 0;
|
||||
virtual int Reject(const CellularCallInfo &callInfo) = 0;
|
||||
|
||||
/**
|
||||
* Is it an emergency call
|
||||
* @param string &phoneNum
|
||||
* @param slotId
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* Hold.
|
||||
*
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
virtual int IsUrgentCall(const std::string &phoneNum, int32_t slotId) = 0;
|
||||
virtual int Hold() = 0;
|
||||
|
||||
/**
|
||||
* Active.
|
||||
*
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
virtual int Active() = 0;
|
||||
|
||||
/**
|
||||
* Swap.
|
||||
*
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
virtual int Swap() = 0;
|
||||
|
||||
/**
|
||||
* IsUrgentCall.
|
||||
*
|
||||
* @param phone number.
|
||||
* @param slotId.
|
||||
* @param errorCode.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
virtual int IsUrgentCall(const std::string &phoneNum, int32_t slotId, int32_t &errorCode) = 0;
|
||||
|
||||
/**
|
||||
* Merge into multiple calls
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int Join() = 0;
|
||||
|
||||
/**
|
||||
* Split.
|
||||
*
|
||||
* @param std::string splitString
|
||||
* @param index
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int Split(const std::string &splitString, int32_t index) = 0;
|
||||
|
||||
/**
|
||||
* CallSupplement.
|
||||
*
|
||||
* @param CallSupplementType
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int CallSupplement(CallSupplementType type) = 0;
|
||||
|
||||
/**
|
||||
* InitiateDTMF.
|
||||
*
|
||||
* @param DTMF Code.
|
||||
* @param phoneNum.
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int InitiateDTMF(char cDTMFCode, const std::string &phoneNum) = 0;
|
||||
|
||||
/**
|
||||
* CeaseDTMF.
|
||||
*
|
||||
* @param phoneNum.
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int CeaseDTMF(const std::string &phoneNum) = 0;
|
||||
|
||||
/**
|
||||
* TransmitDTMF.
|
||||
*
|
||||
* @param DTMF Code.
|
||||
* @param phoneNum.
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int TransmitDTMF(char cDTMFCode, const std::string &phoneNum) = 0;
|
||||
|
||||
/**
|
||||
* Send DTMF String.
|
||||
* @param DTMF Code string.
|
||||
* @param phoneNum.
|
||||
* @param switchOn.
|
||||
* @param switchOff.
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int32_t TransmitDTMFString(
|
||||
const std::string &dtmfCodeStr, const std::string &phoneNum, int32_t switchOn, int32_t switchOff) = 0;
|
||||
|
||||
/**
|
||||
* Set Call Transfer
|
||||
* @param CallTransferInfo
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int32_t SetCallTransfer(const CallTransferInfo &ctInfo, int32_t slotId) = 0;
|
||||
|
||||
/**
|
||||
* Inquire Call Transfer
|
||||
* @param CallTransferType
|
||||
* @param slotId
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int32_t InquireCallTransfer(CallTransferType type, int32_t slotId) = 0;
|
||||
|
||||
/**
|
||||
* Set Call Waiting
|
||||
* @param activate
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int32_t SetCallWaiting(bool activate, int32_t slotId) = 0;
|
||||
|
||||
/**
|
||||
* Inquire Call Waiting
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int32_t InquireCallWaiting(int32_t slotId) = 0;
|
||||
|
||||
/**
|
||||
* Set Call Restriction
|
||||
* @param CallRestrictionInfo
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int32_t SetCallRestriction(const CallRestrictionInfo &cRInfo, int32_t slotId) = 0;
|
||||
|
||||
/**
|
||||
* Inquire Call Restriction
|
||||
* @param CallRestrictionType
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
virtual int32_t InquireCallRestriction(CallRestrictionType facType, int32_t slotId) = 0;
|
||||
|
||||
/**
|
||||
* Register CallBack
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
virtual int RegisterCallManagerCallBack(const sptr<TelephonyCallManager::ICallStatusCallback> &callback) = 0;
|
||||
virtual int RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback) = 0;
|
||||
|
||||
/**
|
||||
* UnRegister CallBack
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
virtual int UnRegisterCallManagerCallBack() = 0;
|
||||
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ipc.CellularCallInterface");
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.CellularCallInterface");
|
||||
};
|
||||
} // namespace CellularCall
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // CELLULAR_CALL_INTERFACE_H
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "cellular_call_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularCall {
|
||||
namespace Telephony {
|
||||
int CellularCallProxy::Dial(const CellularCallInfo &callInfo)
|
||||
{
|
||||
MessageOption option;
|
||||
@ -25,6 +25,9 @@ int CellularCallProxy::Dial(const CellularCallInfo &callInfo)
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
@ -32,7 +35,7 @@ int CellularCallProxy::Dial(const CellularCallInfo &callInfo)
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::End(const CellularCallInfo &callInfo)
|
||||
@ -43,6 +46,9 @@ int CellularCallProxy::End(const CellularCallInfo &callInfo)
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
@ -51,7 +57,7 @@ int CellularCallProxy::End(const CellularCallInfo &callInfo)
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::Reject(const CellularCallInfo &callInfo)
|
||||
@ -63,6 +69,9 @@ int CellularCallProxy::Reject(const CellularCallInfo &callInfo)
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
@ -70,7 +79,7 @@ int CellularCallProxy::Reject(const CellularCallInfo &callInfo)
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::Answer(const CellularCallInfo &callInfo)
|
||||
@ -82,6 +91,9 @@ int CellularCallProxy::Answer(const CellularCallInfo &callInfo)
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
@ -89,10 +101,10 @@ int CellularCallProxy::Answer(const CellularCallInfo &callInfo)
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::IsUrgentCall(const std::string &phoneNum, int32_t slotId)
|
||||
int CellularCallProxy::Hold()
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
@ -101,23 +113,58 @@ int CellularCallProxy::IsUrgentCall(const std::string &phoneNum, int32_t slotId)
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteString(phoneNum)) {
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(slotId)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int error = Remote()->SendRequest(EMERGENCY_CALL, in, out, option);
|
||||
int error = Remote()->SendRequest(HOLD, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::RegisterCallManagerCallBack(const sptr<TelephonyCallManager::ICallStatusCallback> &callback)
|
||||
int CellularCallProxy::Active()
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int error = Remote()->SendRequest(ACTIVE, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::Swap()
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int error = Remote()->SendRequest(SWAP, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback)
|
||||
{
|
||||
if (callback == nullptr) {
|
||||
return -1;
|
||||
return ERR_PARAMETER_INVALID;
|
||||
}
|
||||
|
||||
MessageParcel data;
|
||||
@ -127,15 +174,18 @@ int CellularCallProxy::RegisterCallManagerCallBack(const sptr<TelephonyCallManag
|
||||
if (!data.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!data.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!data.WriteRemoteObject(callback->AsObject().GetRefPtr())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
|
||||
int32_t error = Remote()->SendRequest(REGISTER_CALLBACK, data, reply, option);
|
||||
if (error != ERR_NONE) {
|
||||
return error;
|
||||
if (error == ERR_NONE) {
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::UnRegisterCallManagerCallBack()
|
||||
@ -147,12 +197,359 @@ int CellularCallProxy::UnRegisterCallManagerCallBack()
|
||||
if (!data.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
|
||||
int32_t error = Remote()->SendRequest(UNREGISTER_CALLBACK, data, reply, option);
|
||||
if (error != ERR_NONE) {
|
||||
return error;
|
||||
if (!data.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
return reply.ReadInt32();
|
||||
int32_t error = Remote()->SendRequest(UNREGISTER_CALLBACK, data, reply, option);
|
||||
if (error == ERR_NONE) {
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
} // namespace CellularCall
|
||||
|
||||
int CellularCallProxy::IsUrgentCall(const std::string &phoneNum, int32_t slotId, int32_t &errorCode)
|
||||
{
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
MessageOption option;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteString(phoneNum)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(slotId)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(errorCode)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int error = Remote()->SendRequest(URGENT_CALL, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
error = out.ReadInt32();
|
||||
errorCode = out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::Join()
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int error = Remote()->SendRequest(JOIN, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::Split(const std::string &splitString, int32_t index)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteString(splitString)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(index)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int error = Remote()->SendRequest(SPLIT, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::CallSupplement(CallSupplementType type)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(type)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int error = Remote()->SendRequest(CALL_SUPPLEMENT, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::InitiateDTMF(char cDTMFCode, const std::string &phoneNum)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteCString(&cDTMFCode)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteString(phoneNum)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int error = Remote()->SendRequest(INITIATE_DTMF, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::CeaseDTMF(const std::string &phoneNum)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteString(phoneNum)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int error = Remote()->SendRequest(CEASE_DTMF, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int CellularCallProxy::TransmitDTMF(char cDTMFCode, const std::string &phoneNum)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteCString(&cDTMFCode)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteString(phoneNum)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int error = Remote()->SendRequest(TRANSMIT_DTMF, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CellularCallProxy::TransmitDTMFString(
|
||||
const std::string &dtmfCodeStr, const std::string &phoneNum, int32_t switchOn, int32_t switchOff)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteString(dtmfCodeStr)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteString(phoneNum)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(switchOn)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(switchOff)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int32_t error = Remote()->SendRequest(TRANSMIT_DTMF_STRING, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CellularCallProxy::SetCallTransfer(const CallTransferInfo &ctInfo, int32_t slotId)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteRawData((const void *)&ctInfo, sizeof(CallTransferInfo))) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(slotId)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int32_t error = Remote()->SendRequest(SET_CALL_TRANSFER, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CellularCallProxy::InquireCallTransfer(CallTransferType type, int32_t slotId)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(type)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(slotId)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int32_t error = Remote()->SendRequest(INQUIRE_CALL_TRANSFER, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CellularCallProxy::SetCallWaiting(bool activate, int32_t slotId)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteBool(activate)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(slotId)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int32_t error = Remote()->SendRequest(SET_CALL_WAITING, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CellularCallProxy::InquireCallWaiting(int32_t slotId)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(slotId)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int32_t error = Remote()->SendRequest(INQUIRE_CALL_WAITING, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CellularCallProxy::SetCallRestriction(const CallRestrictionInfo &crInfo, int32_t slotId)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteRawData((const void *)&crInfo, sizeof(CallRestrictionInfo))) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(slotId)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int32_t error = Remote()->SendRequest(SET_CALL_RESTRICTION, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int32_t CellularCallProxy::InquireCallRestriction(CallRestrictionType facType, int32_t slotId)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel in;
|
||||
MessageParcel out;
|
||||
|
||||
if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(DATA_SIZE)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(facType)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
if (!in.WriteInt32(slotId)) {
|
||||
return ERR_SYSTEM_INVOKE;
|
||||
}
|
||||
int32_t error = Remote()->SendRequest(INQUIRE_CALL_RESTRICTION, in, out, option);
|
||||
if (error == ERR_NONE) {
|
||||
return out.ReadInt32();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
168
interfaces/innerkits/cellular_call/proxy/cellular_call_proxy.h
Executable file → Normal file
168
interfaces/innerkits/cellular_call/proxy/cellular_call_proxy.h
Executable file → Normal file
@ -20,7 +20,7 @@
|
||||
#include "iremote_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularCall {
|
||||
namespace Telephony {
|
||||
class CellularCallProxy : public IRemoteProxy<CellularCallInterface> {
|
||||
public:
|
||||
/**
|
||||
@ -36,7 +36,7 @@ public:
|
||||
* Call management dial interface
|
||||
*
|
||||
* @param CellularCallInfo, dial param.
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int Dial(const CellularCallInfo &callInfo) override;
|
||||
|
||||
@ -44,7 +44,7 @@ public:
|
||||
* End.
|
||||
*
|
||||
* @param CellularCallInfo, End param.
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int End(const CellularCallInfo &callInfo) override;
|
||||
|
||||
@ -52,7 +52,7 @@ public:
|
||||
* Reject.
|
||||
*
|
||||
* @param CellularCallInfo, Reject param.
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int Reject(const CellularCallInfo &callInfo) override;
|
||||
|
||||
@ -60,34 +60,164 @@ public:
|
||||
* Answer.
|
||||
*
|
||||
* @param CellularCallInfo, Answer param.
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int Answer(const CellularCallInfo &callInfo) override;
|
||||
|
||||
/**
|
||||
* @brief Is it an emergency call
|
||||
* @param string &phoneNum
|
||||
* @param slotId
|
||||
* @return bool
|
||||
*/
|
||||
int IsUrgentCall(const std::string &phoneNum, int32_t slotId) override;
|
||||
|
||||
/**
|
||||
* RegisterCallBack
|
||||
* Hold.
|
||||
*
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int RegisterCallManagerCallBack(const sptr<TelephonyCallManager::ICallStatusCallback> &callback) override;
|
||||
int Hold() override;
|
||||
|
||||
/**
|
||||
* UnRegister CallBack
|
||||
* @return Returns TELEPHONY_NO_ERROR on success, others on failure.
|
||||
* Active.
|
||||
*
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int Active() override;
|
||||
|
||||
/**
|
||||
* Swap.
|
||||
*
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int Swap() override;
|
||||
|
||||
/**
|
||||
* IsUrgentCall.
|
||||
*
|
||||
* @param phone number.
|
||||
* @param slotId.
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int IsUrgentCall(const std::string &phoneNum, int32_t slotId, int32_t &errorCode) override;
|
||||
|
||||
/**
|
||||
* Merge into multiple calls
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int Join() override;
|
||||
|
||||
/**
|
||||
* Split.
|
||||
*
|
||||
* @param std::string splitString
|
||||
* @param index
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int Split(const std::string &splitString, int32_t index) override;
|
||||
|
||||
/**
|
||||
* CallSupplement.
|
||||
*
|
||||
* @param CallSupplementType type
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int CallSupplement(CallSupplementType type) override;
|
||||
|
||||
/**
|
||||
* InitiateDTMF.
|
||||
*
|
||||
* @param DTMF Code.
|
||||
* @param phoneNum.
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int InitiateDTMF(char cDTMFCode, const std::string &phoneNum) override;
|
||||
|
||||
/**
|
||||
* CeaseDTMF.
|
||||
*
|
||||
* @param phoneNum.
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int CeaseDTMF(const std::string &phoneNum) override;
|
||||
|
||||
/**
|
||||
* TransmitDTMF.
|
||||
*
|
||||
* @param DTMF Code.
|
||||
* @param phoneNum.
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int TransmitDTMF(char cDTMFCode, const std::string &phoneNum) override;
|
||||
|
||||
/**
|
||||
* Send DTMF String.
|
||||
* @param DTMF Code string.
|
||||
* @param phoneNum.
|
||||
* @param switchOn.
|
||||
* @param switchOff.
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int32_t TransmitDTMFString(
|
||||
const std::string &dtmfCodeStr, const std::string &phoneNum, int32_t switchOn, int32_t switchOff) override;
|
||||
|
||||
/**
|
||||
* Set Call Transfer
|
||||
* @param CallTransferInfo
|
||||
* @param slot Id
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int32_t SetCallTransfer(const CallTransferInfo &cfInfo, int32_t slotId) override;
|
||||
|
||||
/**
|
||||
* Inquire Call Transfer
|
||||
* @param CallTransferType
|
||||
* @param slot Id
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int32_t InquireCallTransfer(CallTransferType type, int32_t slotId) override;
|
||||
|
||||
/**
|
||||
* Set Call Waiting
|
||||
* @param activate
|
||||
* @param slot Id
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int32_t SetCallWaiting(bool activate, int32_t slotId) override;
|
||||
|
||||
/**
|
||||
* Inquire Call Waiting
|
||||
* @param slot Id
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int32_t InquireCallWaiting(int32_t slotId) override;
|
||||
|
||||
/**
|
||||
* Set Call Restriction
|
||||
* @param CallRestrictionInfo
|
||||
* @param slot Id
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int32_t SetCallRestriction(const CallRestrictionInfo &crInfo, int32_t slotId) override;
|
||||
|
||||
/**
|
||||
* Inquire Call Restriction
|
||||
* @param CallRestrictionType
|
||||
* @param slot Id
|
||||
* @return Returns kTelephonyNoErr on success, others on failure.
|
||||
*/
|
||||
int32_t InquireCallRestriction(CallRestrictionType facType, int32_t slotId) override;
|
||||
|
||||
/**
|
||||
* RegisterCallManagerCallBack
|
||||
* @param sptr<ICallStatusCallback>
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback) override;
|
||||
|
||||
/**
|
||||
* UnRegister CallManager CallBack
|
||||
* @return Returns TELEPHONY_SUCCESS on success, others on failure.
|
||||
*/
|
||||
int UnRegisterCallManagerCallBack() override;
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<CellularCallProxy> delegator_;
|
||||
const int32_t DATA_SIZE = 10;
|
||||
};
|
||||
} // namespace CellularCall
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // CELLULAR_CALL_PROXY_H
|
||||
|
@ -17,7 +17,9 @@
|
||||
#define CELLULAR_DATA_TYPES_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
namespace CellularData {
|
||||
const uint32_t DATA_FLOW_TYPE_NONE = 0;
|
||||
const uint32_t DATA_STATE_DISCONNECTED = 11;
|
||||
@ -37,6 +39,13 @@ const uint32_t RADIO_TECHNOLOGY_LTE = 108;
|
||||
const uint32_t RADIO_TECHNOLOGY_LTE_CA = 109;
|
||||
const uint32_t RADIO_TECHNOLOGY_IWLAN = 110;
|
||||
const uint32_t RADIO_TECHNOLOGY_NR = 111;
|
||||
|
||||
enum HDataRespondCode {
|
||||
H_CODE_INVALID_PARAM = -1,
|
||||
H_CODE_FAILED = 0,
|
||||
H_CODE_SUCCESS = 1,
|
||||
};
|
||||
} // namespace CellularData
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // CELLULAR_DATA_TYPES_H
|
@ -15,64 +15,117 @@
|
||||
|
||||
#include "cellular_data_service_proxy.h"
|
||||
#include "parcel.h"
|
||||
#include "cellular_data_types.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularData {
|
||||
bool CellularDataServiceProxy::IsCellularDataEnabled(int32_t slotId)
|
||||
namespace Telephony {
|
||||
int32_t CellularDataServiceProxy::IsCellularDataEnabled(int32_t slotId)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(CellularDataServiceProxy::GetDescriptor());
|
||||
data.WriteInt32(slotId);
|
||||
if (Remote() == nullptr) {
|
||||
return CellularData::H_CODE_FAILED;
|
||||
}
|
||||
Remote()->SendRequest(IS_CELLULAR_DATA_ENABLED, data, reply, option);
|
||||
bool result = reply.ReadBool();
|
||||
auto result = reply.ReadInt32();
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t CellularDataServiceProxy::EnableCellularData(int32_t slotId, bool enable)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(CellularDataServiceProxy::GetDescriptor());
|
||||
data.WriteInt32(slotId);
|
||||
data.WriteBool(enable);
|
||||
int32_t result = Remote()->SendRequest(ENABLE_CELLULAR_DATA, data, reply, option);
|
||||
if (Remote() == nullptr) {
|
||||
return CellularData::H_CODE_FAILED;
|
||||
}
|
||||
auto result = Remote()->SendRequest(ENABLE_CELLULAR_DATA, data, reply, option);
|
||||
result = reply.ReadInt32();
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t CellularDataServiceProxy::GetCellularDataState(int32_t slotId)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(CellularDataServiceProxy::GetDescriptor());
|
||||
data.WriteInt32(slotId);
|
||||
if (Remote() == nullptr) {
|
||||
return CellularData::H_CODE_FAILED;
|
||||
}
|
||||
Remote()->SendRequest(GET_CELLULAR_DATA_STATE, data, reply, option);
|
||||
int32_t result = reply.ReadInt32();
|
||||
auto result = reply.ReadInt32();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CellularDataServiceProxy::IsDataRoamingEnabled(int32_t slotId)
|
||||
int32_t CellularDataServiceProxy::IsDataRoamingEnabled(int32_t slotId)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(CellularDataServiceProxy::GetDescriptor());
|
||||
data.WriteInt32(slotId);
|
||||
if (Remote() == nullptr) {
|
||||
return CellularData::H_CODE_FAILED;
|
||||
}
|
||||
Remote()->SendRequest(IS_DATA_ROAMING_ENABLED, data, reply, option);
|
||||
bool result = reply.ReadBool();
|
||||
auto result = reply.ReadInt32();
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t CellularDataServiceProxy::EnableDataRoaming(int32_t slotId, bool enable)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(CellularDataServiceProxy::GetDescriptor());
|
||||
data.WriteInt32(slotId);
|
||||
data.WriteBool(enable);
|
||||
if (Remote() == nullptr) {
|
||||
return CellularData::H_CODE_FAILED;
|
||||
}
|
||||
Remote()->SendRequest(ENABLE_DATA_ROAMING, data, reply, option);
|
||||
int32_t result = reply.ReadInt32();
|
||||
auto result = reply.ReadInt32();
|
||||
return result;
|
||||
}
|
||||
} // namespace CellularData
|
||||
|
||||
int32_t CellularDataServiceProxy::ReleaseNet(std::string ident, uint32_t capability)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(CellularDataServiceProxy::GetDescriptor());
|
||||
data.WriteString(ident);
|
||||
data.WriteUint32(capability);
|
||||
if (Remote() == nullptr) {
|
||||
return CellularData::H_CODE_FAILED;
|
||||
}
|
||||
Remote()->SendRequest(RELEASE_CELLULAR_DATA, data, reply, option);
|
||||
auto result = reply.ReadInt32();
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t CellularDataServiceProxy::RequestNet(std::string ident, uint32_t capability)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(CellularDataServiceProxy::GetDescriptor());
|
||||
data.WriteString(ident);
|
||||
data.WriteUint32(capability);
|
||||
if (Remote() == nullptr) {
|
||||
return CellularData::H_CODE_FAILED;
|
||||
}
|
||||
Remote()->SendRequest(REQUEST_CELLULAR_DATA, data, reply, option);
|
||||
auto result = reply.ReadInt32();
|
||||
return result;
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "iremote_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularData {
|
||||
namespace Telephony {
|
||||
class CellularDataServiceProxy : public IRemoteProxy<ICellularDataManager> {
|
||||
public:
|
||||
explicit CellularDataServiceProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<ICellularDataManager>(impl)
|
||||
@ -31,9 +31,9 @@ public:
|
||||
/**
|
||||
* Whether the cellular data user switch is enabled
|
||||
* @param slotId
|
||||
* @return return ture User data switch on, false User data switch off.
|
||||
* @return return true User data switch on, false User data switch off.
|
||||
*/
|
||||
virtual bool IsCellularDataEnabled(int32_t slotId);
|
||||
virtual int32_t IsCellularDataEnabled(int32_t slotId);
|
||||
|
||||
/**
|
||||
* Whether to enable cellular data user switch
|
||||
@ -57,9 +57,9 @@ public:
|
||||
/**
|
||||
* Whether roaming is allowed
|
||||
* @param slotId
|
||||
* @return return ture Allowed to roam, false not Allowed to roam.
|
||||
* @return return true Allowed to roam, false not Allowed to roam.
|
||||
*/
|
||||
bool IsDataRoamingEnabled(int32_t slotId);
|
||||
int32_t IsDataRoamingEnabled(int32_t slotId);
|
||||
|
||||
/**
|
||||
* Whether roaming switches are allowed
|
||||
@ -69,9 +69,13 @@ public:
|
||||
*/
|
||||
int32_t EnableDataRoaming(int32_t slotId, bool enable);
|
||||
|
||||
int32_t ReleaseNet(std::string ident, uint32_t capability);
|
||||
|
||||
int32_t RequestNet(std::string ident, uint32_t capability);
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<CellularDataServiceProxy> delegator_;
|
||||
};
|
||||
} // namespace CellularData
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // CELLULAR_DATA_SERVICE_PROXY_H
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "iremote_broker.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CellularData {
|
||||
namespace Telephony {
|
||||
class ICellularDataManager : public IRemoteBroker {
|
||||
public:
|
||||
enum {
|
||||
@ -30,21 +30,27 @@ public:
|
||||
ENABLE_DATA_ROAMING,
|
||||
ADD_CELLULAR_DATA_OBSERVER,
|
||||
REMOVE_CELLULAR_DATA_OBSERVER,
|
||||
REQUEST_CELLULAR_DATA,
|
||||
RELEASE_CELLULAR_DATA,
|
||||
};
|
||||
|
||||
virtual bool IsCellularDataEnabled(int32_t slotId) = 0;
|
||||
virtual int32_t IsCellularDataEnabled(int32_t slotId) = 0;
|
||||
|
||||
virtual int32_t EnableCellularData(int32_t slotId, bool enable) = 0;
|
||||
|
||||
virtual int32_t GetCellularDataState(int32_t slotId) = 0;
|
||||
|
||||
virtual bool IsDataRoamingEnabled(int32_t slotId) = 0;
|
||||
virtual int32_t IsDataRoamingEnabled(int32_t slotId) = 0;
|
||||
|
||||
virtual int32_t EnableDataRoaming(int32_t slotId, bool enable) = 0;
|
||||
|
||||
virtual int32_t ReleaseNet(std::string ident, uint32_t capability) = 0;
|
||||
|
||||
virtual int32_t RequestNet(std::string ident, uint32_t capability) = 0;
|
||||
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.telephony.ICellularDataManager");
|
||||
};
|
||||
} // namespace CellularData
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // I_CELLULAR_DATA_MANAGER_H
|
||||
|
30
interfaces/innerkits/common/cellular_data_profile.h
Normal file → Executable file
30
interfaces/innerkits/common/cellular_data_profile.h
Normal file → Executable file
@ -16,31 +16,33 @@
|
||||
#ifndef HOS_CD_PROFILE_H
|
||||
#define HOS_CD_PROFILE_H
|
||||
|
||||
#include "string"
|
||||
#include <string>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class CellularDataProfile {
|
||||
public:
|
||||
CellularDataProfile(int profileId, std::string apn, std::string protocol, int verType, std::string userName,
|
||||
std::string password, std::string roamingProtocol)
|
||||
: profileId(profileId), apn(apn), protocol(protocol), verType(verType), userName(userName),
|
||||
password(password), roamingProtocol(roamingProtocol)
|
||||
: profileId_(profileId), apn_(apn), protocol_(protocol), verType_(verType), userName_(userName),
|
||||
password_(password), roamingProtocol_(roamingProtocol)
|
||||
{}
|
||||
|
||||
~CellularDataProfile() = default;
|
||||
|
||||
public:
|
||||
int profileId;
|
||||
std::string apn; /** (Access Point Name) a string parameter which is a logical name that is used to select the
|
||||
* GGSN or the external packet data network. from 3GPP TS 27.007 10.1 V4.3.0 (2001-12)
|
||||
*/
|
||||
std::string protocol; /** (Packet Data Protocol type) a string parameter which specifies the type of packet
|
||||
* data protocol from 3GPP TS 27.007 10.1 V4.3.0 (2001-12)
|
||||
*/
|
||||
int verType;
|
||||
std::string userName;
|
||||
std::string password;
|
||||
std::string roamingProtocol;
|
||||
int profileId_;
|
||||
std::string apn_; /** (Access Point Name) a string parameter which is a logical name that is used to select the
|
||||
* GGSN or the external packet data network. from 3GPP TS 27.007 10.1 V4.3.0 (2001-12)
|
||||
*/
|
||||
std::string protocol_; /** (Packet Data Protocol type) a string parameter which specifies the type of packet
|
||||
* data protocol from 3GPP TS 27.007 10.1 V4.3.0 (2001-12)
|
||||
*/
|
||||
int verType_;
|
||||
std::string userName_;
|
||||
std::string password_;
|
||||
std::string roamingProtocol_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // HOS_CD_PROFILE_H
|
||||
|
162
interfaces/innerkits/common/core.h
Executable file
162
interfaces/innerkits/common/core.h
Executable file
@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef IMPL_CORE_H
|
||||
#define IMPL_CORE_H
|
||||
|
||||
#include <unistd.h>
|
||||
#include <thread>
|
||||
#include "i_network_search.h"
|
||||
#include "i_sim_file_manager.h"
|
||||
#include "i_sim_state_manager.h"
|
||||
#include "i_sim_sms_manager.h"
|
||||
#include "i_tel_ril_manager.h"
|
||||
#include "i_sim_manager.h"
|
||||
#include "observer_handler.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
const int NUM_CIRCLES = 4;
|
||||
|
||||
class Core {
|
||||
public:
|
||||
Core(int opt);
|
||||
|
||||
~Core() = default;
|
||||
|
||||
void OnInit();
|
||||
bool IsInitCore();
|
||||
|
||||
void InitTelInfo();
|
||||
|
||||
void RegisterPhoneNotify(const std::shared_ptr<AppExecFwk::EventHandler> &handler, int what, void *obj);
|
||||
void UnRegisterPhoneNotify(const std::shared_ptr<AppExecFwk::EventHandler> &observerCallBack, int what);
|
||||
|
||||
void SetRadioStatus(int fun, int rst, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void GetRadioStatus(const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void ShutDown(const AppExecFwk::InnerEvent::Pointer &response);
|
||||
|
||||
void Dial(std::string address, int clirMode, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void DialIms(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void Reject(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void Hangup(int32_t gsmIndex, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void Answer(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void GetCallList(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void Hold(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void Active(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void Swap(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void Join(int32_t callType, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void Split(int32_t nThCall, int32_t callType, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void CallSupplement(int32_t type, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void GetClip(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void SetClip(int32_t action, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void GetClir(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void SetClir(int32_t action, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void SetCallWait(int32_t activate, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void SetCallForward(int32_t reason, int32_t mode, std::string number, int32_t classx,
|
||||
const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void GetCallForward(int32_t reason, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void GetCallWait(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void GetCallRestriction(std::string fac, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void SetCallRestriction(
|
||||
std::string &fac, int32_t mode, std::string &password, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void ActivatePdpContext(int32_t radioTechnology, CellularDataProfile dataProfile, bool isRoaming,
|
||||
bool allowRoaming, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void StopDtmf(int32_t index, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void StartDtmf(char cDTMFCode, int32_t index, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void SendDtmf(char cDTMFCode, int32_t index, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void SendDtmf(const std::string &sDTMFCode, int32_t index, int32_t switchOn, int32_t switchOff,
|
||||
const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void DeactivatePdpContext(int32_t cid, int32_t reason, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
|
||||
void GetSignalStrength(const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void GetCsRegStatus(const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void GetPsRegStatus(const AppExecFwk::InnerEvent::Pointer &response);
|
||||
int32_t GetPsRadioTech(int32_t slotId);
|
||||
int32_t GetCsRadioTech(int32_t slotId);
|
||||
bool SetNetworkSelectionMode(int32_t slotId, int32_t selectMode,
|
||||
const sptr<NetworkInformation> networkInformation, bool resumeSelection,
|
||||
const sptr<INetworkSearchCallback> &callback);
|
||||
std::vector<sptr<SignalInformation>> GetSignalInfoList(int32_t slotId);
|
||||
std::u16string GetOperatorNumeric(int32_t slotId);
|
||||
std::u16string GetOperatorName(int32_t slotId);
|
||||
sptr<NetworkState> GetNetworkStatus(int32_t slotId);
|
||||
bool SetRadioState(int32_t slotId, bool isOn, int32_t rst, const sptr<INetworkSearchCallback> &callback);
|
||||
bool GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback);
|
||||
std::u16string GetIsoCountryCodeForNetwork(int32_t slotId);
|
||||
bool GetNetworkSearchResult(int32_t slotId, const sptr<INetworkSearchCallback> &callback);
|
||||
bool GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback);
|
||||
void RegisterIccStateChanged(const std::shared_ptr<AppExecFwk::EventHandler> &handler);
|
||||
void RegisterImsiLoaded(const std::shared_ptr<AppExecFwk::EventHandler> &handler);
|
||||
void RegisterAllFilesLoaded(const std::shared_ptr<AppExecFwk::EventHandler> &handler);
|
||||
int32_t ObtainSpnCondition(bool roaming, std::string operatorNum);
|
||||
std::u16string GetSpn(int32_t slotId);
|
||||
void GetOperatorInfo(const AppExecFwk::InnerEvent::Pointer &response);
|
||||
|
||||
void SendSms(std::string smscPdu, std::string pdu, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void StorageSms(
|
||||
int32_t status, std::string smscPdu, std::string pdu, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
|
||||
void GetSmsCenterAddress(const AppExecFwk::InnerEvent::Pointer &response);
|
||||
|
||||
void SetSmsCenterAddress(int32_t tosca, std::string address, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
|
||||
void DeleteSms(int32_t gsmIndex, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void SendSmsMoreMode(std::string smscPdu, std::string pdu, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void SendSmsAck(bool success, int32_t cause, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
|
||||
void SetCellBroadcast(
|
||||
int32_t mode, std::string idList, std::string dcsList, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
|
||||
void GetSimStatus(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void ReadIccFile(int32_t command, int32_t fileId, int32_t p1, int32_t p2, int32_t p3, std::string data,
|
||||
std::string path, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void GetImsi(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void GetIccID(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void GetSimLockStatus(std::string fac, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void SetSimLock(
|
||||
std::string fac, int32_t mode, std::string passwd, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void ChangeSimPassword(std::string fac, std::string oldPassword, std::string newPassword,
|
||||
int32_t passwordLength, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void EnterSimPin(std::string pin, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void UnlockSimPin(std::string puk, std::string pin, const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void GetSimPinInputTimes(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void GetNetworkSearchInformation(const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void GetNetworkSelectionMode(const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void SetNetworkSelectionMode(
|
||||
int32_t automaticFlag, std::string oper, const AppExecFwk::InnerEvent::Pointer &response);
|
||||
void SetNetworkLocationUpdate(const AppExecFwk::InnerEvent::Pointer &result);
|
||||
void TelRilSetParam(int32_t preferredNetworkType, int32_t cdmaSubscription, int32_t instanceId);
|
||||
bool InitCellularRadio(bool isFirst);
|
||||
std::shared_ptr<INetworkSearch> GetNetworkSearchManager() const;
|
||||
std::shared_ptr<IRilManager> GetRilManager() const;
|
||||
std::shared_ptr<ISimFileManager> GetSimFileManager() const;
|
||||
std::shared_ptr<ISimStateManager> GetSimStateManager() const;
|
||||
std::shared_ptr<ISimSmsManager> GetSimSmsManager() const;
|
||||
std::shared_ptr<ISimManager> GetSimManager() const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<INetworkSearch> networkSearchManager_ = nullptr;
|
||||
std::shared_ptr<IRilManager> rilManager_ = nullptr;
|
||||
std::shared_ptr<ISimFileManager> simFileManager_ = nullptr;
|
||||
std::shared_ptr<ISimStateManager> simStateManager_ = nullptr;
|
||||
std::shared_ptr<ISimSmsManager> simSmsManager_ = nullptr;
|
||||
std::shared_ptr<ISimManager> simManager_ = nullptr;
|
||||
int slotId_;
|
||||
bool isInitCore_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif
|
51
interfaces/innerkits/common/core_manager.h
Normal file
51
interfaces/innerkits/common/core_manager.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_CORE_MANAGER_H
|
||||
#define OHOS_CORE_MANAGER_H
|
||||
|
||||
#include "singleton.h"
|
||||
#include "core.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class CoreManager {
|
||||
public:
|
||||
static const int32_t SLOT_ID1 = 0;
|
||||
static const int32_t DEFAULT_SLOT_ID = SLOT_ID1;
|
||||
|
||||
static CoreManager &GetInstance();
|
||||
~CoreManager() = default;
|
||||
int32_t Init();
|
||||
void ReleaseCore();
|
||||
|
||||
std::shared_ptr<Core> getCore(int slotId);
|
||||
|
||||
std::map<int, std::shared_ptr<Core>> core_;
|
||||
|
||||
private:
|
||||
CoreManager() = default;
|
||||
CoreManager(const CoreManager &) = delete;
|
||||
CoreManager &operator=(const CoreManager &) = delete;
|
||||
CoreManager(CoreManager &&) = delete;
|
||||
CoreManager &operator=(CoreManager &&) = delete;
|
||||
static CoreManager *coreManager_;
|
||||
static std::mutex mutex_;
|
||||
|
||||
static const int32_t DEFAULT_SLOT_NUM = 1;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_CORE_MANAGER_H
|
@ -1,378 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_RIL_H
|
||||
#define OHOS_RIL_H 1
|
||||
|
||||
#include <net/if.h>
|
||||
#include <stdint.h>
|
||||
#include "hril_request.h"
|
||||
#include "hril_notification.h"
|
||||
|
||||
#define HRIL_VERSION 1
|
||||
#define HRIL_VERSION_MIN 1
|
||||
typedef void *HRilHandle;
|
||||
|
||||
typedef enum { HRIL_SIM_1, HRIL_SIM_NUM } HRilSimId;
|
||||
|
||||
typedef enum {
|
||||
HRIL_ERR_SUCCESS = 0,
|
||||
HRIL_ERR_INVALID_ARGUMENTS = 1,
|
||||
HRIL_ERR_MEMORY_FULL = 2,
|
||||
} HRilErrno;
|
||||
|
||||
/* From 3GPP TS 27.007 V4.3.0 (2001-12) ATD%s%s */
|
||||
typedef enum {
|
||||
HRIL_CALL_ACTIVATE = 0,
|
||||
HRIL_CALL_HOLDING = 1,
|
||||
HRIL_CALL_DIALING = 2,
|
||||
HRIL_CALL_REMIND = 3,
|
||||
HRIL_CALL_INCOMING = 4,
|
||||
HRIL_CALL_WAITING = 5
|
||||
} HRilCallState;
|
||||
|
||||
typedef enum {
|
||||
HRIL_RADIO_POWER_STATE_OFF = 0,
|
||||
HRIL_RADIO_POWER_STATE_UNAVAILABLE = 1,
|
||||
HRIL_RADIO_POWER_STATE_ON = 2,
|
||||
} HRilRadioState;
|
||||
|
||||
typedef enum {
|
||||
HRIL_RADIO_TECHNOLOGY_UNKNOWN,
|
||||
HRIL_RADIO_TECHNOLOGY_GSM,
|
||||
HRIL_RADIO_TECHNOLOGY_1xRTT,
|
||||
HRIL_RADIO_TECHNOLOGY_WCDMA
|
||||
} HRilRadioAccessTechnology;
|
||||
|
||||
/* From 3GPP TS 27.007 V4.3.0 (2001-12) AT+CGDCONT */
|
||||
typedef struct {
|
||||
HRilCallState state;
|
||||
int index;
|
||||
int typeOfAddress; /* Type of address octet in integer format (refer TS 24.008 [8] subclause 10.5.4.7);
|
||||
* default 145 when dialling string includes international access code character "+",
|
||||
* otherwise 129. see 3GPP TS 27.007 V4.3.0 (2001-12) 6.1 */
|
||||
char isEmpty; /* 0 call is not one of multiparty (conference) call parties
|
||||
* 1 call is one of multiparty (conference) call parties */
|
||||
char isMT; /* integer type; call identification number as described in 3GPP TS 22.030 [19] subclause 4.5.5.1;
|
||||
* this number can be used in +CHLD command operations
|
||||
* 0 mobile originated (MO) call
|
||||
* 1 mobile terminated (MT) call */
|
||||
char als; /* Alternate Line Service */
|
||||
char isVoice; /* <mode> (bearer/teleservice): voice call */
|
||||
char isPrivacyMode; /* value is true when CDMA voice privacy mode was activated */
|
||||
char *remoteNumber; /* Parameters <n> and <m> are used to enable/disable the presentation of incoming
|
||||
* User-to-User Information Elements.When <n> = 1 and a User-to-User Information is
|
||||
* received after a mobile originated call setup or after hanging up a call, intermediate
|
||||
* result code +CUUS1I: <messageI>,<UUIE> is sent to the TE. When <m> = 1 and a
|
||||
* User-to-User Information is received during a mobile terminated call setup or during a
|
||||
* remote party call hangup, unsolicited result code +CUUS1U: <messageU>,<UUIE> is sent to
|
||||
* the TE. */
|
||||
int numberRemind; /* The command refers to an integer that allows a called party to enable or disable (<n>=0)
|
||||
* the reporting of the ID of calling parties, and specifies the method of presentation of
|
||||
* the ID. This is basically the same as GSM/UMTS supplementary service CLIP (Calling Line
|
||||
* Identification Presentation). The presentation may be either formatted (<n>=1) or
|
||||
* unformatted (<n>=2): Formatted presentation : data items are reported in the form of
|
||||
* <tag>=<value> pairs. <tag> <value> DATE MMDD (month, day) TIME HHMM (hour,
|
||||
* minute) NMBR calling number or P or O (P = number is private, O = number is
|
||||
* unavailable) NAME subscription listing name MESG data from other (unknown) tags
|
||||
*/
|
||||
char *remoteName; /* Remote party name */
|
||||
int nameRemind; /* This command refers to the GSM/UMTS supplementary service CLIP (Calling Line
|
||||
* Identification Presentation) that enables a called subscriber to get the calling line
|
||||
* identity (CLI) of the calling party when receiving a mobile terminated call. Set command
|
||||
* enables or disables the presentation of the CLI at the TE. It has no effect on the execution
|
||||
* of the supplementary service CLIP in the network. */
|
||||
} HRilCallInfo;
|
||||
|
||||
typedef struct {
|
||||
int state; /* from 3GPP TS 27.007 10.1.10 V4.3.0 (2001-12)
|
||||
* indicates the state of PDP context activation
|
||||
* 0 - deactivated
|
||||
* 1 - activated */
|
||||
int retryTime; /* if errorCode != 0, suggested retry time */
|
||||
int cid; /* from 3GPP TS 27.007 10.1.1 V4.3.0 (2001-12)
|
||||
* specifies a particular PDP context definition. The parameter is local to the TE-MT interface and
|
||||
* is used in other PDP context-related commands. */
|
||||
int active; /* 0: inactive, 1: active(physical link down), 2 : 2=active (physical link up) */
|
||||
char *type; /* PDP_type values from 3GPP TS 27.007 section 10.1.1.
|
||||
* specifies the type of packet data protocol. The default value is manufacturer specific. */
|
||||
char *netPortName; /* Network interface name */
|
||||
char *address; /* from 3GPP TS 27.007 10.1.1 V4.3.0 (2001-12)
|
||||
* a string parameter that identifies the MT in the address space applicable to the PDP. */
|
||||
char *dns; /* If the MT indicates more than two IP addresses of P-CSCF servers
|
||||
* or more than two IP addresses of DNS servers,
|
||||
* multiple lines of information per <cid> will be returned.
|
||||
* If the MT has dual stack capabilities,
|
||||
* First one line with the IPv4 parameters followed by one line with the IPv6 parameters. */
|
||||
char *gateway; /* network gateway address */
|
||||
int mtu; /* Maximum Transfer Unit. The range of permitted values (minimum value = 1
|
||||
* or if the initial PDP context is supported minimum value = 0)
|
||||
* is returned by the test form of the command. */
|
||||
} HRilDataCallResponse;
|
||||
|
||||
typedef enum {
|
||||
RADIO_TECH_3GPP = 1, /* 3GPP Technologies (GSM, WCDMA) */
|
||||
RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies (CDMA) */
|
||||
} HRilRadioTechnologyFamily;
|
||||
|
||||
typedef struct {
|
||||
int msgRef; /* TP-Message-Reference for GSM, and BearerData MessageId for CDMA
|
||||
* from 3GPP2 C.S0015-B, v2.0, 4.5-1 */
|
||||
char *pdu; /* Protocol Data Unit */
|
||||
int errCode; /* if unknown or not applicable, that is -1
|
||||
* from 3GPP 27.005, 3.2.5 for GSM/UMTS,
|
||||
* 3GPP2 N.S0005 (IS-41C) Table 171 for CDMA */
|
||||
} HRilSmsResponse;
|
||||
|
||||
/* From 3GPP TS 27.007 V4.3.0 (2001-12) ATD%s%s */
|
||||
typedef struct {
|
||||
char *address; /* Type of address octet in integer format (refer TS 24.008 [8] subclause 10.5.4.7);
|
||||
* default 145 when dialling string includes international access code character "+", otherwise
|
||||
* 129.
|
||||
* */
|
||||
int clir; /* This command refers to CLIR service according to 3GPP TS 22.081 [3] that allows a calling subscriber
|
||||
* to enable or disable the presentation of the CLI to the called party when originating a call. <n>
|
||||
* (parameter sets the adjustment for outgoing calls): 0 presentation indicator is used according to
|
||||
* the subscription of the CLIR service 1 CLIR invocation 2 CLIR suppression <m> (parameter shows
|
||||
* the subscriber CLIR service status in the network): 0 CLIR not provisioned 1 CLIR provisioned in
|
||||
* permanent mode 2 unknown (e.g. no network, etc.) 3 CLIR temporary mode presentation restricted
|
||||
* 4 CLIR temporary mode presentation allowed */
|
||||
} HRilDial;
|
||||
|
||||
/* Form 3GPP TS 27.007 V4.3.0 (2001-12) 8.18, + CRSM */
|
||||
typedef struct {
|
||||
int command; /* This command related to a network service that provides "multiple called numbers
|
||||
* (called line identifications) service" to an MT. This command enables a called subscriber to
|
||||
* get the called line identification of the called party when receiving a mobile terminated call.
|
||||
* Set command enables or disables the presentation of the called line identifications at the TE.
|
||||
<n> (parameter sets/shows the result code presentation status in the TA):
|
||||
* 0 disable
|
||||
* 1 enable
|
||||
* <m> (parameter shows the subscriber "multiple called numbers" service status in the network):
|
||||
* 0 "multiple called numbers service" is not provisioned
|
||||
* 1 "multiple called numbers service" is provisioned
|
||||
* 2 unknown (e.g. no network, etc.)
|
||||
* <number>: string type phone number of format specified by <type>
|
||||
* <type>: type of address octet in integer format (refer TS 24.008 [8] subclause 10.5.4.7)
|
||||
* <subaddr>: string type subaddress of format specified by <satype>
|
||||
* <satype>: type of subaddress octet in integer format (refer TS 24.008 [8] subclause 10.5.4.8) */
|
||||
int fileid; /* By using this command instead of Generic SIM Access +CSIM TE application has easier
|
||||
* but more limited access to the SIM database. Set command transmits to the ME the SIM <command>
|
||||
* and its required parameters. ME handles internally all SIM ME interface locking and file
|
||||
* selection routines. As response to the command, ME sends the actual SIM information parameters
|
||||
* and response data. ME error result code +CME ERROR may be returned when the command cannot be
|
||||
* passed to the SIM, but failure in the execution of the command in the SIM is reported in <sw1>
|
||||
* and <sw2> parameters. Refer to subclause 9.2 for <err> values. <command> (command passed on by
|
||||
* the ME to the SIM; refer GSM 51.011 [28]): 176 READ BINARY 178 READ RECORD 192 GET RESPONSE 214
|
||||
* UPDATE BINARY 220 UPDATE RECORD 242 STATUS all other values are reserved */
|
||||
char *path; /* Action command returns the MSISDNs related to the subscriber (this information can be stored
|
||||
* in the SIM/UICC or in the ME).
|
||||
* <typex>: type of address octet in integer format (refer TS 24.008 [8] subclause 10.5.4.7)
|
||||
* <speed>: as defined in subclause 6.7
|
||||
* <service> (service related to the phone number):
|
||||
* 0 asynchronous modem eth0
|
||||
* 1 synchronous modem
|
||||
* 2 PAD Access (asynchronous)
|
||||
* 3 Packet Access (synchronous)
|
||||
* 4 voice
|
||||
* 5 fax */
|
||||
int p1; /* By using this command instead of Generic SIM Access +CSIM TE application has easier but
|
||||
* more limited access to the SIM database. parameters passed on by the ME to the SIM.
|
||||
* <P1>, <P2>, <P3>: integer type; parameters passed on by the ME to the SIM.
|
||||
* These parameters are mandatory for every command, except GET RESPONSE and STATUS.
|
||||
* The values are described in GSM 51.011 [28]. */
|
||||
int p2; /* By using this command instead of Generic SIM Access +CSIM TE application has easier but
|
||||
* more limited access to the SIM database. parameters passed on by the ME to the SIM.
|
||||
* <P1>, <P2>, <P3>: integer type; parameters passed on by the ME to the SIM.
|
||||
* These parameters are mandatory for every command, except GET RESPONSE and STATUS.
|
||||
* The values are described in GSM 51.011 [28]. */
|
||||
int p3; /* By using this command instead of Generic SIM Access +CSIM TE application has easier but
|
||||
* more limited access to the SIM database. parameters passed on by the ME to the SIM.
|
||||
* <P1>, <P2>, <P3>: integer type; parameters passed on by the ME to the SIM.
|
||||
* These parameters are mandatory for every command, except GET RESPONSE and STATUS.
|
||||
* The values are described in GSM 51.011 [28]. */
|
||||
char *data; /* By using this command instead of Generic SIM Access +CSIM TE application has easier but
|
||||
* more limited access to the SIM database.
|
||||
* <data>: information which shall be written to the SIM (hexadecimal character format; refer
|
||||
* +CSCS) */
|
||||
char *pin2;
|
||||
char *aid; /* AID value, from ETSI 102.221 8.1 and 101.220 4, if no value that is NULL */
|
||||
} HRilSimIO;
|
||||
|
||||
/* Form TS 27.007.8.18 +CRSM */
|
||||
typedef struct {
|
||||
int sw1; /* By using this command instead of Generic SIM Access +CSIM TE application has easier but
|
||||
* more limited access to the SIM database.
|
||||
* <sw1>, <sw2>: integer type; information from the SIM about the execution of the actual command.
|
||||
* These parameters are delivered to the TE in both cases, on successful or
|
||||
* failed execution of the command */
|
||||
int sw2; /* By using this command instead of Generic SIM Access +CSIM TE application has easier but
|
||||
* more limited access to the SIM database.
|
||||
* <sw1>, <sw2>: integer type; information from the SIM about the execution of the actual command.
|
||||
* These parameters are delivered to the TE in both cases, on successful or
|
||||
* failed execution of the command */
|
||||
char *response; /* By using this command instead of Generic SIM Access +CSIM TE application has easier but
|
||||
* more limited access to the SIM database.
|
||||
* <response>: response of a successful completion of the command previously issued
|
||||
* (hexadecimal character format; refer +CSCS). STATUS and GET RESPONSE return data,
|
||||
* which gives information about the current
|
||||
* elementary datafield. After READ BINARY or READ RECORD command
|
||||
* the requested data will be returned. <response> is not returned
|
||||
* after a successful UPDATE BINARY or UPDATE RECORD command */
|
||||
} HRilSimIOResponse;
|
||||
|
||||
typedef enum {
|
||||
HRIL_CALL_FAIL_NO_VALID_NUMBER = 1,
|
||||
HRIL_CALL_FAIL_NO_LINE_TO_TARGET_ADDRESS = 3
|
||||
} HRilLastCallErrorCode;
|
||||
|
||||
typedef struct {
|
||||
HRilLastCallErrorCode errorCode; /* Execution command causes the TA to return one or more lines of information
|
||||
* text <report>, determined by the ME manufacturer, which should offer
|
||||
* the user of the TA an extended report of the reason for
|
||||
* the failure in the last unsuccessful call setup (originating or answering) or
|
||||
* in call modification;
|
||||
* the last call release;
|
||||
* the last unsuccessful GPRS attach or unsuccessful PDP context activation;
|
||||
* the last GPRS detach or PDP context deactivation. */
|
||||
char *vendorError; /* Error codes of vendor. */
|
||||
} HRilLastCallErrorCodeInfo;
|
||||
|
||||
typedef enum { HRIL_ABSENT = 0, HRIL_PRESENT = 1, HRIL_ERROR = 2, HRIL_RESTRICTED = 3 } HRilIccCardState;
|
||||
|
||||
typedef enum {
|
||||
HRIL_SIMLOCK_UNKNOWN = 0,
|
||||
HRIL_SIMLOCK_IN_PROGRESS = 1,
|
||||
HRIL_SIMLOCK_READY = 2,
|
||||
} HRilIccSimLockSub;
|
||||
|
||||
typedef enum {
|
||||
HRIL_UNKNOWNSTATE = 0,
|
||||
HRIL_DETECTED = 1,
|
||||
HRIL_PIN = 2,
|
||||
HRIL_PUK = 3,
|
||||
HRIL_SIMLOCK = 4,
|
||||
HRIL_STATEREADY = 5
|
||||
} HRilIccStatus;
|
||||
|
||||
typedef enum {
|
||||
HRIL_PIN_STATE_UNKNOWN,
|
||||
HRIL_PIN_NOT_VERIFIED,
|
||||
HRIL_PIN_VERIFIED,
|
||||
HRIL_PIN_DISABLED,
|
||||
HRIL_PIN_BLOCKED_ENABLED,
|
||||
HRIL_PIN_BLOCKED_PERM
|
||||
} HRilIccPinState;
|
||||
|
||||
typedef enum {
|
||||
HRIL_UNKNOWNTYPE = 0,
|
||||
HRIL_SIM = 1,
|
||||
HRIL_USIM = 2,
|
||||
HRIL_RUIM = 3,
|
||||
HRIL_CSIM = 4,
|
||||
HRIL_ISIM = 5
|
||||
} HRilIccType;
|
||||
|
||||
#define HRIL_SIM_MAX_APPS 8
|
||||
typedef struct {
|
||||
HRilIccType iccType;
|
||||
HRilIccStatus iccStatus;
|
||||
HRilIccSimLockSub SimLockSubState;
|
||||
char *aid;
|
||||
char *iccTag;
|
||||
int substitueOfPin1;
|
||||
HRilIccPinState stateOfPin1;
|
||||
HRilIccPinState stateOfPin2;
|
||||
} HRilIccContent;
|
||||
|
||||
typedef struct {
|
||||
HRilIccCardState cardState;
|
||||
HRilIccPinState pinState;
|
||||
int contentIndexOfGU;
|
||||
int contentIndexOfCdma;
|
||||
int contentIndexOfIms;
|
||||
int iccContentNum;
|
||||
HRilIccContent iccContent[HRIL_SIM_MAX_APPS];
|
||||
} HRilIccState;
|
||||
|
||||
/* From 3GPP TS 27.007 8.5 */
|
||||
typedef struct {
|
||||
int rssi; /* Execution command returns received signal strength indication.
|
||||
* Refer subclause 9.2 . From 3GPP TS 27.007 V4.3.0 */
|
||||
int ber; /* bit error rate, value range 0 ~ 7, max is 99, if unknown then set to max */
|
||||
} HRilGwRssi;
|
||||
|
||||
/* From 3GPP TS 27.007 V4.3.0 (2001-12) AT+CSQ */
|
||||
typedef struct {
|
||||
int rssi; /* Received Signal Strength Indication, value range 0 ~ 31, max is 99, if unknown then set to max */
|
||||
int ber; /* bit error rate, value range 0 ~ 7, max is 99, if unknown then set to max */
|
||||
int ta; /* Timing Advance in bit periods. if unknown then set to max, e.g: 1 bit period = 48/13 us */
|
||||
} HRilGsmRssi;
|
||||
|
||||
/* From 3GPP TS 27.007 8.5 */
|
||||
typedef struct {
|
||||
int rssi; /* Received Signal Strength Indication, value range 0 ~ 31, max is 99, if unknown then set to max */
|
||||
int ber; /* bit error rate, value range 0 ~ 7, max is 99, if unknown then set to max */
|
||||
} HRilWcdmaRssi;
|
||||
|
||||
/* From 3GPP TS 27.007 8.69 */
|
||||
typedef struct {
|
||||
int absoluteRssi; /* Absolute value of signal strength. This value is the actual Rssi value
|
||||
* multiplied by -1.
|
||||
* e.g: Rssi is -75, then this response value will be 75 */
|
||||
int ecno; /* ratio of the received energy per PN chip to the total received power spectral density,
|
||||
* e.g: If the actual Ec/Io is -12.5 dB, then this response value will be 125.
|
||||
* from 3GPP TS 25.133[95] */
|
||||
} HRilCdmaRssi;
|
||||
|
||||
typedef struct {
|
||||
HRilGwRssi gwRssi;
|
||||
HRilCdmaRssi cdmaRssi;
|
||||
} HRilRssi;
|
||||
|
||||
typedef void (*HRilRequestFunc)(int request, void *data, size_t dataLen, HRilHandle t);
|
||||
|
||||
typedef HRilRadioState (*HRilRadioStateRequest)();
|
||||
|
||||
typedef int (*HRilSupports)(int requestCode);
|
||||
|
||||
typedef void (*HRilCancel)(HRilHandle t);
|
||||
|
||||
typedef void (*HRilTimedCallback)(void *param);
|
||||
|
||||
typedef const char *(*HRilGetVersion)(void);
|
||||
|
||||
typedef struct {
|
||||
int version; /* set to HRIL_VERSION */
|
||||
HRilRequestFunc onRequest;
|
||||
HRilRadioStateRequest onStateRequest;
|
||||
HRilSupports supports;
|
||||
HRilCancel onCancel;
|
||||
HRilGetVersion getVersion;
|
||||
} VendorCallbacks;
|
||||
|
||||
struct HRilInitEnv {
|
||||
void (*OnRequestResponse)(HRilHandle t, HRilErrno e, void *response, size_t responseLen);
|
||||
|
||||
void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t dataLen);
|
||||
|
||||
void (*RequestTimedCallback)(HRilTimedCallback callback, void *param, const struct timeval *relativeTime);
|
||||
|
||||
void (*OnRequestAck)(HRilHandle t);
|
||||
};
|
||||
|
||||
const VendorCallbacks *RilInit(const struct HRilInitEnv *env, int argc, char **argv);
|
||||
|
||||
#endif // OHOS_RIL_H
|
@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef OHOS_RIL_CALL_PARCEL_H
|
||||
#define OHOS_RIL_CALL_PARCEL_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "parcel.h"
|
||||
#include "string_ex.h"
|
||||
#include "hril_types.h"
|
||||
|
||||
namespace OHOS {
|
||||
/* From 3GPP TS 27.007 V4.3.0 (2001-12) 7.7, AT + ATD */
|
||||
struct DialInfo : public Parcelable {
|
||||
int32_t serial;
|
||||
std::string address;
|
||||
int32_t clir; /* Calling Line Identification Restriction . From TS 27.007 V3.4.0 (2000-03) */
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<DialInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct UusData : public Parcelable {
|
||||
int32_t uusDcs; /* Cell Broadcast Data Coding Scheme(default 0). */
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<UusData> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct CallInfo : public Parcelable {
|
||||
int32_t state;
|
||||
int32_t index;
|
||||
int32_t typeOfAddress; /* type of address, see 3GPP TS 23.140 [58]. */
|
||||
bool isEmpty; /* value is true when number is empty */
|
||||
bool isMT; /* value is true when call is mobile terminated */
|
||||
int32_t als; /* Alternate Line Service */
|
||||
bool isVoice; /* value is true when it is a voice call */
|
||||
std::string remoteNumber; /* Parameters <n> and <m> are used to enable/disable the presentation of incoming
|
||||
* User-to-User Information Elements.When <n> = 1 and a User-to-User Information is
|
||||
* received after a mobile originated call setup or after hanging up a call,
|
||||
* intermediate result code +CUUS1I: <messageI>,<UUIE> is sent to the TE. When <m> =
|
||||
* 1 and a User-to-User Information is received during a mobile terminated call setup
|
||||
* or during a remote party call hangup, unsolicited result code
|
||||
* +CUUS1U: <messageU>,<UUIE> is sent to the TE. */
|
||||
int32_t numberRemind; /* The command refers to an integer that allows a called party to enable or disable
|
||||
* (<n>=0) the reporting of the ID of calling parties, and specifies the method of
|
||||
* presentation of the ID. This is basically the same as GSM/UMTS supplementary service
|
||||
* CLIP (Calling Line Identification Presentation). The presentation may be either
|
||||
* formatted (<n>=1) or unformatted (<n>=2): Formatted presentation : data items are
|
||||
* reported in the form of <tag>=<value> pairs. <tag> <value> DATE MMDD
|
||||
* (month, day) TIME HHMM (hour, minute) NMBR calling number or P or O (P =
|
||||
* number is private, O = number is unavailable) NAME subscription listing name MESG
|
||||
* data from other (unknown) tags */
|
||||
std::string remoteName; /* Remote party name */
|
||||
int32_t nameRemind; /* This command refers to the GSM/UMTS supplementary service CLIP (Calling Line
|
||||
* Identification Presentation) that enables a called subscriber to get the calling line
|
||||
* identity (CLI) of the calling party when receiving a mobile terminated call. Set command
|
||||
* enables or disables the presentation of the CLI at the TE. It has no effect on the
|
||||
* execution of the supplementary service CLIP in the network. */
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<CallInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct CallInfoList : public Parcelable {
|
||||
int32_t callSize;
|
||||
std::vector<CallInfo> calls;
|
||||
int32_t flag;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<CallInfoList> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_RIL_CALL_PARCEL_H
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef OHOS_RIL_DATA_PARCEL_H
|
||||
#define OHOS_RIL_DATA_PARCEL_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "parcel.h"
|
||||
#include "string_ex.h"
|
||||
#include "hril_types.h"
|
||||
|
||||
namespace OHOS {
|
||||
struct SetupDataCallResultInfo : public Parcelable {
|
||||
int32_t flag;
|
||||
int32_t state; /* from 3GPP TS 27.007 10.1.10 V4.3.0 (2001-12)
|
||||
* indicates the state of PDP context activation
|
||||
* 0 - deactivated
|
||||
* 1 - activated */
|
||||
int32_t retryTime; /* if errorCode != 0, suggested retry time */
|
||||
int32_t cid; /* from 3GPP TS 27.007 10.1.1 V4.3.0 (2001-12)
|
||||
* specifies a particular PDP context definition. The parameter is local to the TE-MT interface
|
||||
* and is used in other PDP context-related commands. */
|
||||
int32_t active; /* 0: inactive, 1: active(physical link down), 2 : 2=active (physical link up) */
|
||||
std::string type; /* PDP_type values from 3GPP TS 27.007 V4.3.0 section 10.1.1.
|
||||
* specifies the type of packet data protocol. The default value is manufacturer specific. */
|
||||
std::string netPortName; /* Network interface name */
|
||||
std::string address; /* from 3GPP TS 27.007 10.1.1 V4.3.0 (2001-12)
|
||||
* a string parameter that identifies the MT in the address space applicable to the PDP. */
|
||||
std::string dns; /* If the MT indicates more than two IP addresses of P-CSCF servers
|
||||
* or more than two IP addresses of DNS servers,
|
||||
* multiple lines of information per <cid> will be returned.
|
||||
* If the MT has dual stack capabilities,
|
||||
* First one line with the IPv4 parameters followed by one line with the IPv6 parameters. */
|
||||
std::string gateway; /* network gateway address */
|
||||
int32_t mtu; /* Maximum Transfer Unit. The range of permitted values (minimum value = 1
|
||||
* or if the initial PDP context is supported minimum value = 0)
|
||||
* is returned by the test form of the command. */
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<SetupDataCallResultInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct DataCallResultList : public Parcelable {
|
||||
int32_t size; /* Size of DataCall List */
|
||||
std::vector<SetupDataCallResultInfo> dcList; /* DataCall List */
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<DataCallResultList> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
/* from 3GPP TS 27.007 10.1 V4.3.0 (2001-12) */
|
||||
struct DataProfileDataInfo : public Parcelable {
|
||||
int32_t serial;
|
||||
int32_t profileId; /* Id of data profiles */
|
||||
std::string apn; /* (Access Point Name) a string parameter
|
||||
* which is a logical name that is used to select the GGSN or the */
|
||||
std::string protocol; /* (Packet Data Protocol type) a string parameter which
|
||||
* specifies the type of packet data protocol */
|
||||
std::string roamingProtocol;
|
||||
int32_t verType; /* APN verification type */
|
||||
std::string userName;
|
||||
std::string password;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<DataProfileDataInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct DataProfilesInfo : public Parcelable {
|
||||
int32_t serial;
|
||||
int32_t profilesSize;
|
||||
std::vector<DataProfileDataInfo> profiles;
|
||||
bool isRoaming;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<DataProfilesInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct DataCallInfo : public Parcelable {
|
||||
int32_t serial;
|
||||
int32_t radioTechnology; /* Voice radio technology */
|
||||
DataProfileDataInfo dataProfileInfo;
|
||||
bool modemCognitive; /* 1:APN setting setDataProfile. 0: no */
|
||||
bool roamingAllowed;
|
||||
bool isRoaming;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<DataCallInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_RIL_DATA_PARCEL_H
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef OHOS_RIL_NETWORK_PARCEL_H
|
||||
#define OHOS_RIL_NETWORK_PARCEL_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "parcel.h"
|
||||
#include "string_ex.h"
|
||||
#include "hril_types.h"
|
||||
|
||||
namespace OHOS {
|
||||
struct OperatorInfoResult : public Parcelable {
|
||||
std::string longName;
|
||||
std::string shortName;
|
||||
std::string numeric;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<OperatorInfoResult> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
/* Voice registration status results */
|
||||
struct CsRegStatusInfo : public Parcelable {
|
||||
int32_t regStatus; /* The corresponding valid registration states are NOT_REG_MT_NOT_SEARCHING_OP,
|
||||
* "REG_HOME, NOT_REG_MT_SEARCHING_OP, REG_DENIED, UNKNOWN, REG_ROAMING". */
|
||||
int32_t radioTechnology; /* Available voice radio technology, RMS defined by radio technology */
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<CsRegStatusInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct PsRegStatusResultInfo : public Parcelable {
|
||||
int32_t regStatus; /* valid when are is ITE UNKNOWN REG = REG, otherwise it defined in RegStatus */
|
||||
int32_t radioTechnology;
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<PsRegStatusResultInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_RIL_NETWORK_PARCEL_H
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef OHOS_RIL_REQUEST_H
|
||||
#define OHOS_RIL_REQUEST_H
|
||||
#define HRIL_RESPONSE_ACKNOWLEDGEMENT 800
|
||||
typedef enum {
|
||||
HREQ_CALL_BASE = 0,
|
||||
HREQ_CALL_GET_CALL_LIST,
|
||||
HREQ_CALL_DIAL,
|
||||
HREQ_CALL_HANGUP,
|
||||
HREQ_CALL_REJECT,
|
||||
HREQ_CALL_ANSWER,
|
||||
|
||||
HREQ_SMS_BASE = 100,
|
||||
HREQ_SMS_SEND_SMS,
|
||||
HREQ_SMS_SEND_SMS_MORE_MODE,
|
||||
HREQ_SMS_SEND_SMS_ACK,
|
||||
HREQ_SMS_IMS_SEND_SMS,
|
||||
|
||||
HREQ_SIM_BASE = 200,
|
||||
HREQ_SIM_GET_SIM_STATUS,
|
||||
HREQ_SIM_GET_IMSI,
|
||||
HREQ_SIM_READ_ICC_FILE,
|
||||
|
||||
HREQ_DATA_BASE = 300,
|
||||
HREQ_DATA_DEACTIVATE_PDP_CONTEXT,
|
||||
HREQ_DATA_ACTIVATE_PDP_CONTEXT,
|
||||
|
||||
HREQ_NETWORK_BASE = 400,
|
||||
HREQ_NETWORK_GET_SIGNAL_STRENGTH,
|
||||
HREQ_NETWORK_GET_CS_REG_STATUS,
|
||||
HREQ_NETWORK_GET_PS_REG_STATUS,
|
||||
HREQ_NETWORK_GET_OPERATOR_INFO,
|
||||
|
||||
HREQ_COMMON_BASE = 500,
|
||||
HREQ_MODEM_SET_RADIO_POWER
|
||||
} HRilRequest;
|
||||
#endif // OHOS_RIL_REQUEST_H
|
@ -1,125 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef OHOS_RIL_SIM_PARCEL_H
|
||||
#define OHOS_RIL_SIM_PARCEL_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "parcel.h"
|
||||
#include "string_ex.h"
|
||||
#include "hril_types.h"
|
||||
namespace OHOS {
|
||||
enum class SimRefreshTypeInd : int32_t { SIM_FILE_UPDATE = 0, SIM_INIT = 1, SIM_RESET = 2 };
|
||||
|
||||
/* Form 3GPP TS 27.007 V4.3.0 (2001-12) 8.18, + CRSM */
|
||||
struct IccIoResultInfo : public Parcelable {
|
||||
int32_t sw1; /* information from the SIM about the execution of the actual command.
|
||||
* These parameters are delivered to the TE in both cases,
|
||||
* on successful or failed execution of the command */
|
||||
int32_t sw2;
|
||||
std::string response;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<IccIoResultInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
/* Form 3GPP TS 27.007 V4.3.0 (2001-12) 8.18, + CRSM */
|
||||
struct IndicationInfo : public Parcelable {
|
||||
int32_t sw1; /* information from the SIM about the execution of the actual command.
|
||||
* These parameters are delivered to the TE in both cases,
|
||||
* on successful or failed execution of the command */
|
||||
int32_t sw2;
|
||||
std::string response;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<IndicationInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
/* Form 3GPP TS 27.007 V4.3.0 (2001-12) 8.18, + CRSM */
|
||||
struct IccIoRequestInfo : public Parcelable {
|
||||
int32_t fileId; /* this is the identifier of a elementary datafile on SIM.
|
||||
* Mandatory for every command except STATUS */
|
||||
std::string path; /* contains the path of an elementary file on the SIM/UICC
|
||||
* in hexadecimal format as defined in ETSI TS 102 221 [60]
|
||||
* (e.g. "7F205F70" in SIM and UICC case).
|
||||
* The <pathid> shall only be used in the mode
|
||||
* "select by path from MF" as defined in ETSI TS 102 221 [60] */
|
||||
int32_t cmd; /* command passed on by the ME to the SIM; refer GSM 51.011 [28] */
|
||||
int32_t p1; /* parameters passed on by the MT to the SIM.
|
||||
* These parameters are mandatory for every command,
|
||||
* except GET RESPONSE and STATUS.
|
||||
* The values are described in 3GPP TS 51.011 [28] */
|
||||
int32_t p2;
|
||||
int32_t p3;
|
||||
int32_t serial;
|
||||
std::string data; /* information which shall be written to the SIM
|
||||
* (hexadecimal character format; refer +CSCS). */
|
||||
std::string pin2;
|
||||
std::string aid; /* AID value, from ETSI 102.221 8.1 and 101.220 4, if no value that is NULL */
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<IccIoRequestInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
/* From ETSI 102.221 8.1 and 101.220 4 */
|
||||
struct SimRefreshResultInd : public Parcelable {
|
||||
int32_t type;
|
||||
int32_t efId; /* EFID is the updated file if the result is */
|
||||
std::string aid; /* application ID is the card application */
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<SimRefreshResultInd> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct IccContentInfo : public Parcelable {
|
||||
int32_t SimLockSubState;
|
||||
std::string aid;
|
||||
std::string iccTag;
|
||||
int32_t substitueOfPin1;
|
||||
int32_t stateOfPin1;
|
||||
int32_t stateOfPin2;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<IccContentInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct CardStatusInfo : public Parcelable {
|
||||
int32_t cardState;
|
||||
int32_t iccType;
|
||||
int32_t iccStatus;
|
||||
int32_t pinState;
|
||||
int32_t contentIndexOfGU;
|
||||
int32_t contentIndexOfCdma;
|
||||
int32_t contentIndexOfIms;
|
||||
int32_t iccContentNum;
|
||||
|
||||
std::vector<IccContentInfo> iccContentInfo;
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<CardStatusInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_RIL_SIM_PARCEL_H
|
@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef OHOS_RIL_SMS_PARCEL_H
|
||||
#define OHOS_RIL_SMS_PARCEL_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "parcel.h"
|
||||
#include "string_ex.h"
|
||||
#include "hril_types.h"
|
||||
namespace OHOS {
|
||||
struct GsmSmsMessageInfo : public Parcelable {
|
||||
int32_t serial;
|
||||
std::string smscPdu; /* Short Message Service Center Protocol Data Unit see GSM 03.40 */
|
||||
std::string pdu; /* Protocol Data Unit */
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<GsmSmsMessageInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct ImsSmsMessageInfo : public Parcelable {
|
||||
int32_t serial;
|
||||
int32_t technology;
|
||||
bool retry; /* if errorCode != 0, suggested retry time */
|
||||
int32_t msgRef; /* TP-Message-Reference for GSM,and BearerData MessageId for CDMA
|
||||
* from 3GPP2 C.S0015-B, v2.0, 4.5-1 */
|
||||
int32_t gsmMessageSize;
|
||||
std::vector<GsmSmsMessageInfo> gsmMessage;
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<ImsSmsMessageInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct SmsMessageInfo : public Parcelable {
|
||||
int32_t indicationType;
|
||||
int32_t size;
|
||||
std::vector<uint8_t> pdu; /* Protocol Data Unit */
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<SmsMessageInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct ModeData : public Parcelable {
|
||||
int32_t serial;
|
||||
bool result;
|
||||
int32_t mode;
|
||||
std::string pdu; /* Protocol Data Unit */
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<ModeData> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
|
||||
struct SendSmsResultInfo : public Parcelable {
|
||||
int32_t msgRef; /* TP-Message-Reference for GSM,and BearerData MessageId for CDMA
|
||||
* from 3GPP2 C.S0015-B, v2.0, 4.5-1 */
|
||||
std::string pdu; /* Protocol Data Unit */
|
||||
int32_t errCode;
|
||||
int64_t flag;
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<SendSmsResultInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_RIL_SMS_PARCEL_H
|
@ -1,151 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef TELEPHONY_N_TYPE_H
|
||||
#define TELEPHONY_N_TYPE_H
|
||||
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "hril.h"
|
||||
|
||||
namespace OHOS {
|
||||
enum class HRilErrType { NONE, HRIL_ERR_INVALID_RESPONSE };
|
||||
|
||||
enum class HRilResponseType {
|
||||
HRIL_RESPONSE,
|
||||
HRIL_RESP_ACK,
|
||||
HRIL_RESP_ACK_NEED,
|
||||
};
|
||||
|
||||
enum class HRilNotiType {
|
||||
HRIL_NOTIFICATION,
|
||||
HRIL_NOTIFICATION_ACK_NEED,
|
||||
};
|
||||
|
||||
enum class HRilApnTypes : int32_t {
|
||||
NONE = 0,
|
||||
DEFAULT = 2 ^ 0,
|
||||
MMS = 2 ^ 1,
|
||||
SUPL = 2 ^ 2,
|
||||
DUN = 2 ^ 3,
|
||||
HIPRI = 2 ^ 4,
|
||||
FOTA = 2 ^ 5,
|
||||
IMS = 2 ^ 6,
|
||||
CBS = 2 ^ 7,
|
||||
IA = 2 ^ 8,
|
||||
EMERGENCY = 2 ^ 9,
|
||||
ALL = (2 ^ 10) - 1,
|
||||
};
|
||||
|
||||
/* From 3GPP TS 27.007 V4.3.0 (2001-12) 8.5, AT + CSQ */
|
||||
struct GsmRssi {
|
||||
uint32_t rssi; /* Received Signal Strength Indication, value range 0 ~ 31, max is 99, if unknown then set to max */
|
||||
uint32_t ber; /* bit error rate, value range 0 ~ 7, max is 99, if unknown then set to max
|
||||
* as RXQUAL values in the table in TS 45.008 [20] subclause 8.2.4. */
|
||||
int32_t ta; /* Timing Advance in bit periods. if unknown then set to max, e.g: 1 bit period = 48/13 us */
|
||||
};
|
||||
|
||||
/* From 3GPP TS 27.007 8.69 */
|
||||
struct CdmaRssi {
|
||||
uint32_t absoluteRssi; /* Absolute value of signal strength. This value is the actual Rssi value
|
||||
* multiplied by -1.
|
||||
* e.g: Rssi is -75, then this response value will be 75 */
|
||||
uint32_t ecno; /* ratio of the received energy per PN chip to the total received power spectral density,
|
||||
* e.g: If the actual Ec/Io is -12.5 dB, then this response value will be 125.
|
||||
* from 3GPP TS 25.133[95] */
|
||||
};
|
||||
|
||||
struct Rssi {
|
||||
int32_t slotId;
|
||||
GsmRssi gw;
|
||||
CdmaRssi cdma;
|
||||
};
|
||||
|
||||
struct HRilRadioResponseInfo {
|
||||
int32_t serial;
|
||||
HRilResponseType type;
|
||||
HRilErrType error;
|
||||
};
|
||||
|
||||
struct CommonInfo {
|
||||
int32_t serial;
|
||||
int32_t type;
|
||||
bool flag;
|
||||
int32_t arg1;
|
||||
int32_t arg2;
|
||||
};
|
||||
|
||||
enum HRilCommonNumber {
|
||||
HRIL_DEC = 10,
|
||||
HRIL_INVALID_HEX_CHAR = 16,
|
||||
HRIL_UPPER_CASE_LETTERS_OFFSET = 32,
|
||||
HRIL_SIGNAL_STRENGTH_MAX = 99,
|
||||
HRIL_ADAPTER_RADIO_INDICATION = 2001,
|
||||
HRIL_ADAPTER_RADIO_RESPONSE = 2002
|
||||
};
|
||||
|
||||
enum HRilOperatorInfoResult {
|
||||
HRIL_LONE_NAME = 0,
|
||||
HRIL_SHORT_NAME,
|
||||
HRIL_NUMERIC,
|
||||
};
|
||||
|
||||
enum HRilCircuitModeRegState {
|
||||
HRIL_STAT_NO_REG_MT_NO_SEARCHING_OP = 0, /* not registered, MT is not searching an operator */
|
||||
HRIL_STAT_REGISTERED_HOME_NETWORK = 1, /* registered, home network */
|
||||
HRIL_STAT_NO_REGISTERED_MT_TRY_ATTACH = 2, /* not registered, but MT is currently trying
|
||||
* to attach or searching an operator */
|
||||
HRIL_STAT_REGISTERED_DENIED = 3, /* registration denied */
|
||||
HRIL_STAT_UNKNOWN = 4, /* unknown (e.g. out of GERAN/UTRAN coverage) */
|
||||
HRIL_STAT_REGISTERED_ROAMING = 5, /* registered, roaming */
|
||||
HRIL_STAT_REGISTERED_SMS_HOME_NETWORK = 6, /* registered for "SMS only", home network (not applicable) */
|
||||
HRIL_STAT_REGISTERED_SMS_ROAMING = 7,
|
||||
};
|
||||
|
||||
enum HRilServiceSupportStat {
|
||||
HRIL_SERVICE_NO_SUPPORT = 0,
|
||||
HRIL_SERVICE_SUPPORT = 1,
|
||||
};
|
||||
|
||||
/* from 3GPP TS 27.007 V17.1.0 9.2.2.1.1 */
|
||||
enum HRilReasonDataDenied {
|
||||
HREASON_GPRS_SERVICE_NOT_ALLOW = 0,
|
||||
HREASON_GPRS_AND_NONGPRS_SERVICE_NOT_ALLOW = 1,
|
||||
HREASON_MS_INDENTITY_CANNOT_BE_DERIVED = 2,
|
||||
HREASON_IMPLICITLY_DETACHED = 3,
|
||||
HREASON_GPRS_SERVICE_NOT_ALLOW_IN_PLMN = 4,
|
||||
HREASON_MSC_TEM_NOT_REACH = 5,
|
||||
HREASON_NO_DPD_CONTEXT_ACTIVATED = 6,
|
||||
};
|
||||
|
||||
// cs registration response
|
||||
static constexpr uint32_t HRIL_CS_REG_STATE = 0;
|
||||
static constexpr uint32_t HRIL_CS_REG_RESP_RAT = 3;
|
||||
static constexpr uint32_t HRIL_RSSNR = 7;
|
||||
static constexpr uint32_t HRIL_CS_REG_RESP_ROMING_INDICATOR = 10;
|
||||
static constexpr uint32_t HRIL_CS_REG_RESP_SYSTEM_IS_IN_PRL = 11;
|
||||
static constexpr uint32_t HRIL_CS_REG_RESP_DEFAULT_ROAMING_INDICATOR = 12;
|
||||
static constexpr uint32_t HRIL_CS_REG_RESP_TIMING_ADVANCE = 13;
|
||||
static constexpr uint32_t HRIL_CS_REG_STATUS_MAX_LEN = 15;
|
||||
// ps registration response
|
||||
static constexpr uint32_t HRIL_PS_REG_STATUS_MAX_LEN = 6;
|
||||
static constexpr uint32_t HRIL_PS_REG_STATE = 0;
|
||||
static constexpr uint32_t HRIL_PS_RADIO_TECHNOLOGY = 3;
|
||||
static constexpr uint32_t HRIL_PS_DENIED_ERROR_CODE = 4;
|
||||
static constexpr uint32_t HRIL_PS_MAX_DATA_CALLS = 5;
|
||||
static constexpr uint32_t HRIL_PS_DEF_DATA_CALLS_VAL = 1;
|
||||
} // namespace OHOS
|
||||
#endif // TELEPHONY_N_TYPE_H
|
47
interfaces/innerkits/common/i_network_search.h
Normal file → Executable file
47
interfaces/innerkits/common/i_network_search.h
Normal file → Executable file
@ -13,36 +13,43 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_I_NS_MANAGER_H
|
||||
#define OHOS_I_NS_MANAGER_H
|
||||
#ifndef I_NETWORK_SEARCH_H
|
||||
#define I_NETWORK_SEARCH_H
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "event_handler.h"
|
||||
#include "network_state.h"
|
||||
#include "signal_information.h"
|
||||
#include "network_search_result.h"
|
||||
#include "i_network_search_callback.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class INetworkSearch {
|
||||
public:
|
||||
using HANDLE = const std::shared_ptr<AppExecFwk::EventHandler>;
|
||||
virtual void Init();
|
||||
virtual int32_t GetPsRadioTech(int32_t slotId) = 0;
|
||||
virtual int32_t GetCsRadioTech(int32_t slotId) = 0;
|
||||
virtual std::u16string GetOperatorNumeric(int32_t slotId) = 0;
|
||||
virtual std::u16string GetOperatorName(int32_t slotId) = 0;
|
||||
virtual sptr<NetworkState> GetNetworkStatus(int32_t slotId) = 0;
|
||||
virtual bool GetRadioState(int32_t slotId) = 0;
|
||||
virtual void SetHRilRadioState(bool isOn) = 0;
|
||||
virtual std::vector<sptr<SignalInformation>> GetSignalInfoList(int32_t slotId) = 0;
|
||||
virtual void RegisterForPSConnectionAttached(const HANDLE &handler) = 0;
|
||||
virtual void UnregisterForPSConnectionAttached(const HANDLE &handler) = 0;
|
||||
virtual void RegisterForPSConnectionDetached(const HANDLE &handler) = 0;
|
||||
virtual void UnregisterForPSConnectionDetached(const HANDLE &handler) = 0;
|
||||
virtual int32_t GetPsRadioTech(int32_t slotId) const = 0;
|
||||
virtual int32_t GetCsRadioTech(int32_t slotId) const = 0;
|
||||
virtual std::u16string GetOperatorNumeric(int32_t slotId) const = 0;
|
||||
virtual std::u16string GetOperatorName(int32_t slotId) const = 0;
|
||||
virtual sptr<NetworkState> GetNetworkStatus(int32_t slotId) const = 0;
|
||||
virtual int32_t GetRadioState(int32_t slotId) const = 0;
|
||||
virtual bool GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
|
||||
virtual void SetRadioState(int32_t slotId, bool isOn, int32_t rst) = 0;
|
||||
virtual bool SetRadioState(
|
||||
int32_t slotId, bool isOn, int32_t rst, const sptr<INetworkSearchCallback> &callback) = 0;
|
||||
virtual std::vector<sptr<SignalInformation>> GetSignalInfoList(int32_t slotId) const = 0;
|
||||
virtual void RegisterPhoneNotify(
|
||||
const std::shared_ptr<AppExecFwk::EventHandler> &handler, int what, void *obj) = 0;
|
||||
virtual void UnRegisterPhoneNotify(const std::shared_ptr<AppExecFwk::EventHandler> &handler, int what) = 0;
|
||||
virtual bool GetNetworkSearchResult(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
|
||||
virtual bool GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
|
||||
virtual bool SetNetworkSelectionMode(int32_t slotId, int32_t selectMode,
|
||||
const sptr<NetworkInformation> &networkInformation, bool resumeSelection,
|
||||
const sptr<INetworkSearchCallback> &callback) = 0;
|
||||
virtual std::u16string GetIsoCountryCodeForNetwork(int32_t slotId) const = 0;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // CORE_SERVICE_IRIL_MANAGER_H
|
||||
#endif // I_NETWORK_SEARCH_H
|
||||
|
41
interfaces/innerkits/common/i_network_search_callback.h
Normal file
41
interfaces/innerkits/common/i_network_search_callback.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef I_NETWORK_SEARCH_CALLBACK_H
|
||||
#define I_NETWORK_SEARCH_CALLBACK_H
|
||||
|
||||
#include <iremote_proxy.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class INetworkSearchCallback : public IRemoteBroker {
|
||||
public:
|
||||
enum NetworkSearchCallback {
|
||||
GET_AVAILABLE_RESULT = 0,
|
||||
GET_NETWORK_MODE_RESULT,
|
||||
SET_NETWORK_MODE_RESULT,
|
||||
GET_RADIO_STATUS_RESULT,
|
||||
SET_RADIO_STATUS_RESULT
|
||||
};
|
||||
|
||||
virtual ~INetworkSearchCallback() = default;
|
||||
virtual int32_t OnNetworkSearchCallback(NetworkSearchCallback requestId, MessageParcel &data) = 0;
|
||||
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.INetworkSearchCallback");
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // I_NETWORK_SEARCH_CALLBACK_H
|
24
interfaces/innerkits/common/i_sim_file_manager.h
Normal file → Executable file
24
interfaces/innerkits/common/i_sim_file_manager.h
Normal file → Executable file
@ -16,32 +16,26 @@
|
||||
#ifndef OHOS_I_SIM_FILE_MANAGER_H
|
||||
#define OHOS_I_SIM_FILE_MANAGER_H
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "event_handler.h"
|
||||
#include "event_runner.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace SIM {
|
||||
namespace Telephony {
|
||||
class ISimFileManager {
|
||||
public:
|
||||
using HANDLE = std::shared_ptr<AppExecFwk::EventHandler>;
|
||||
virtual void Init() {}
|
||||
virtual std::u16string GetSimOperator(int32_t slotId) = 0;
|
||||
virtual std::u16string GetIsoCountryCode(int32_t slotId) = 0;
|
||||
virtual std::u16string GetSpn(int32_t slotId) = 0;
|
||||
virtual std::u16string GetIccId(int32_t slotId) = 0;
|
||||
virtual std::u16string GetSimOperatorNumeric(int32_t slotId) = 0;
|
||||
virtual std::u16string GetIsoCountryCodeForSim(int32_t slotId) = 0;
|
||||
virtual std::u16string GetSimSpn(int32_t slotId) = 0;
|
||||
virtual std::u16string GetSimIccId(int32_t slotId) = 0;
|
||||
virtual std::u16string GetIMSI(int32_t slotId) = 0;
|
||||
virtual std::u16string GetLocaleFromDefaultSim() = 0;
|
||||
virtual std::u16string GetSimGid1(int32_t slotId) = 0;
|
||||
virtual int ObtainSpnCondition(bool roaming, std::string operatorNum) = 0;
|
||||
virtual void RegisterImsiLoaded(std::shared_ptr<AppExecFwk::EventHandler> eventHandler) = 0;
|
||||
virtual void UnregisterImsiLoaded(const std::shared_ptr<AppExecFwk::EventHandler> &handler) = 0;
|
||||
virtual void RegisterAllFilesLoaded(std::shared_ptr<AppExecFwk::EventHandler> eventHandler) = 0;
|
||||
virtual void UnregisterAllFilesLoaded(const std::shared_ptr<AppExecFwk::EventHandler> &handler) = 0;
|
||||
virtual void SetImsi(std::string imsi) = 0;
|
||||
};
|
||||
} // namespace SIM
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif
|
||||
|
151
interfaces/innerkits/common/i_sim_manager.h
Normal file
151
interfaces/innerkits/common/i_sim_manager.h
Normal file
@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef TELEPHONY_I_SIM_MANAGER_H
|
||||
#define TELEPHONY_I_SIM_MANAGER_H
|
||||
|
||||
#include <unordered_map>
|
||||
#include "parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
const int32_t CARRIER_CONFIG_STEP = 2;
|
||||
const std::u16string DEFAULT_DISPLAY_NAME = u"simDefaultDisplayName";
|
||||
const std::u16string DEFAULT_DISPLAY_NUMBER = u"simDefaultDisplayNumber";
|
||||
|
||||
struct CarrierConfig : public Parcelable {
|
||||
std::u16string configName;
|
||||
std::u16string iccId;
|
||||
std::unordered_map<std::u16string, std::u16string> configMap;
|
||||
|
||||
bool Marshalling(Parcel &parcel) const
|
||||
{
|
||||
if (!parcel.WriteString16(configName)) {
|
||||
return false;
|
||||
}
|
||||
if (!parcel.WriteString16(iccId)) {
|
||||
return false;
|
||||
}
|
||||
if (!configMap.empty() && configMap.size() > 0) {
|
||||
std::vector<std::u16string> configVector;
|
||||
auto it = configMap.begin();
|
||||
while (it != configMap.end()) {
|
||||
configVector.emplace_back(it->first);
|
||||
configVector.emplace_back(it->second);
|
||||
it++;
|
||||
}
|
||||
if (!parcel.WriteString16Vector(configVector)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
std::shared_ptr<CarrierConfig> UnMarshalling(Parcel &parcel)
|
||||
{
|
||||
std::shared_ptr<CarrierConfig> param = std::make_shared<CarrierConfig>();
|
||||
if (param == nullptr || !param->ReadFromParcel(parcel)) {
|
||||
param = nullptr;
|
||||
}
|
||||
return param;
|
||||
};
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel)
|
||||
{
|
||||
parcel.ReadString16(configName);
|
||||
parcel.ReadString16(iccId);
|
||||
configMap.clear();
|
||||
std::vector<std::u16string> *configVector = nullptr;
|
||||
parcel.ReadString16Vector(configVector);
|
||||
int i = 0;
|
||||
while ((int)configVector->size() > i) {
|
||||
configMap.emplace(
|
||||
std::pair<std::u16string, std::u16string>(configVector->at(i), configVector->at(i + 1)));
|
||||
i += CARRIER_CONFIG_STEP;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
bool operator==(const CarrierConfig &p)
|
||||
{
|
||||
return (configName == p.configName && iccId == p.iccId);
|
||||
}
|
||||
};
|
||||
|
||||
struct IccAccountInfo : public Parcelable {
|
||||
int32_t slotIndex;
|
||||
std::u16string displayName;
|
||||
std::u16string displayNumber;
|
||||
|
||||
void Init(int32_t slotIndex, std::u16string displayName = DEFAULT_DISPLAY_NAME,
|
||||
std::u16string displayNumber = DEFAULT_DISPLAY_NUMBER)
|
||||
{
|
||||
this->slotIndex = slotIndex;
|
||||
this->displayName = displayName;
|
||||
this->displayNumber = displayNumber;
|
||||
};
|
||||
|
||||
bool Marshalling(Parcel &parcel) const
|
||||
{
|
||||
if (!parcel.WriteInt32(slotIndex)) {
|
||||
return false;
|
||||
}
|
||||
if (!parcel.WriteString16(displayName)) {
|
||||
return false;
|
||||
}
|
||||
if (!parcel.WriteString16(displayNumber)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
std::shared_ptr<IccAccountInfo> UnMarshalling(Parcel &parcel)
|
||||
{
|
||||
std::shared_ptr<IccAccountInfo> param = std::make_shared<IccAccountInfo>();
|
||||
if (param == nullptr || !param->ReadFromParcel(parcel)) {
|
||||
param = nullptr;
|
||||
}
|
||||
return param;
|
||||
};
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel)
|
||||
{
|
||||
parcel.ReadInt32(slotIndex);
|
||||
parcel.ReadString16(displayName);
|
||||
parcel.ReadString16(displayNumber);
|
||||
return true;
|
||||
};
|
||||
|
||||
bool operator==(const IccAccountInfo &p)
|
||||
{
|
||||
return (slotIndex == p.slotIndex);
|
||||
}
|
||||
};
|
||||
|
||||
class ISimManager {
|
||||
public:
|
||||
ISimManager() {};
|
||||
virtual ~ISimManager() {};
|
||||
virtual void Init();
|
||||
virtual bool GetSimAccountInfo(int32_t subId, IccAccountInfo &info);
|
||||
virtual bool SetDefaultVoiceSlotId(int32_t subId);
|
||||
virtual bool SetDefaultSmsSlotId(int32_t subId);
|
||||
virtual int32_t GetDefaultVoiceSlotId();
|
||||
virtual int32_t GetDefaultSmsSlotId();
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // TELEPHONY_I_SIM_MANAGER_H
|
26
network_search/include/radio_info_state.h → interfaces/innerkits/common/i_sim_sms_manager.h
Normal file → Executable file
26
network_search/include/radio_info_state.h → interfaces/innerkits/common/i_sim_sms_manager.h
Normal file → Executable file
@ -12,22 +12,20 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef UNTITLED_RADIO_STATE_H
|
||||
#define UNTITLED_RADIO_STATE_H
|
||||
#include <memory>
|
||||
|
||||
#ifndef OHOS_I_SIM_SMS_MANAGER_H
|
||||
#define OHOS_I_SIM_SMS_MANAGER_H
|
||||
|
||||
namespace OHOS {
|
||||
class NetworkSearchManager;
|
||||
class RadioInfoState {
|
||||
namespace Telephony {
|
||||
class ISimSmsManager {
|
||||
public:
|
||||
RadioInfoState();
|
||||
explicit RadioInfoState(std::shared_ptr<NetworkSearchManager> const &networkSearchManager);
|
||||
virtual ~RadioInfoState() = default;
|
||||
void SetToTheSuitableState();
|
||||
void ProcessRadioChange();
|
||||
|
||||
private:
|
||||
std::shared_ptr<NetworkSearchManager> networkSearchManager_;
|
||||
virtual void Init() {}
|
||||
virtual bool AddSmsToIcc(int status, std::string &pdu, std::string &smsc) = 0;
|
||||
virtual bool RenewSmsIcc(int index, int status, std::string &pduData, std::string &smsc) = 0;
|
||||
virtual bool DelSmsIcc(int index) = 0;
|
||||
virtual std::vector<std::string> ObtainAllSmsOfIcc() = 0;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // UNTITLED_RADIO_STATE_H
|
||||
#endif
|
@ -16,16 +16,34 @@
|
||||
#ifndef OHOS_I_SIM_STATE_MANAGER_H
|
||||
#define OHOS_I_SIM_STATE_MANAGER_H
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "event_handler.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace SIM {
|
||||
namespace Telephony {
|
||||
enum UnlockResult {
|
||||
UNLOCK_FAIL = -2, // unlock fail
|
||||
UNLOCK_INCORRECT = -1, // password error
|
||||
UNLOCK_OK = 0, // unlock sucessful
|
||||
};
|
||||
|
||||
enum ExternalState {
|
||||
EX_UNKNOWN,
|
||||
EX_ABSENT,
|
||||
EX_PIN_LOCKED,
|
||||
EX_PUK_LOCKED,
|
||||
EX_SIMLOCK,
|
||||
EX_READY,
|
||||
EX_UNREADY,
|
||||
EX_BLOCKED_PERM,
|
||||
EX_ICC_ERROR,
|
||||
EX_ICC_RESTRICTED,
|
||||
};
|
||||
|
||||
struct LockStatusResponse {
|
||||
int32_t result;
|
||||
int32_t remain;
|
||||
};
|
||||
|
||||
class ISimStateManager {
|
||||
public:
|
||||
using HANDLE = const std::shared_ptr<AppExecFwk::EventHandler>;
|
||||
@ -33,12 +51,23 @@ public:
|
||||
virtual bool HasSimCard(int32_t slotId) = 0;
|
||||
virtual int32_t GetSimState(int32_t slotId) = 0;
|
||||
virtual bool IsSimActive(int32_t slotId) = 0;
|
||||
virtual bool UnlockPin(std::string pin, LockStatusResponse &response, int32_t slotId) = 0;
|
||||
virtual bool UnlockPuk(std::string newPin, std::string puk, LockStatusResponse &response, int32_t phoneId) = 0;
|
||||
virtual bool AlterPin(
|
||||
std::string newPin, std::string oldPin, LockStatusResponse &response, int32_t phoneId) = 0;
|
||||
virtual bool SetLockState(std::string pin, int32_t enable, LockStatusResponse &response, int32_t phoneId) = 0;
|
||||
virtual int32_t GetLockState(int32_t phoneId) = 0;
|
||||
virtual int32_t RefreshSimState(int32_t slotId) = 0;
|
||||
// Event register
|
||||
virtual void RegisterForIccStateChanged(HANDLE &handler) = 0;
|
||||
virtual void UnregisterForIccStateChanged(HANDLE &handler) = 0;
|
||||
virtual void RegisterForReady(HANDLE &handler) = 0;
|
||||
virtual void UnregisterForReady(HANDLE &handler) = 0;
|
||||
virtual void RegisterIccStateChanged(HANDLE &handler) = 0;
|
||||
virtual void UnregisterIccStateChanged(HANDLE &handler) = 0;
|
||||
virtual void RegisterIccReady(HANDLE &handler) = 0;
|
||||
virtual void UnregisterIccReady(HANDLE &handler) = 0;
|
||||
virtual void RegisterIccLocked(HANDLE &handler) = 0;
|
||||
virtual void UnregisterIccLocked(HANDLE &handler) = 0;
|
||||
virtual void RegisterIccSimLock(HANDLE &handler) = 0;
|
||||
virtual void UnregisterIccSimLock(HANDLE &handler) = 0;
|
||||
};
|
||||
} // namespace SIM
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_I_SIM_MANAGER_H
|
||||
|
@ -13,20 +13,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef CORE_SERVICE_IRIL_MANAGER_H
|
||||
#define CORE_SERVICE_IRIL_MANAGER_H
|
||||
#ifndef I_TEL_RIL_MANAGER_H
|
||||
#define I_TEL_RIL_MANAGER_H
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include "cellular_data_profile.h"
|
||||
#include "event_handler.h"
|
||||
#include "event_runner.h"
|
||||
#include "hril_types.h"
|
||||
|
||||
namespace OHOS {
|
||||
enum ModemPowerState { CORE_SERVICE_POWER_OFF, CORE_SERVICE_POWER_NOT_AVAILABLE, CORE_SERVICE_POWER_ON };
|
||||
namespace Telephony {
|
||||
enum ModemPowerState { CORE_SERVICE_POWER_OFF, CORE_SERVICE_POWER_ON, CORE_SERVICE_POWER_NOT_AVAILABLE };
|
||||
|
||||
class IRilManager {
|
||||
public:
|
||||
@ -36,19 +32,41 @@ public:
|
||||
|
||||
virtual void RegisterPhoneNotify(
|
||||
const std::shared_ptr<AppExecFwk::EventHandler> &handler, int what, void *obj) = 0;
|
||||
virtual void UnRegisterPhoneNotify(int what) = 0;
|
||||
virtual void UnRegisterPhoneNotify(
|
||||
const std::shared_ptr<AppExecFwk::EventHandler> &observerCallBack, int what) = 0;
|
||||
|
||||
virtual void SetRadioPower(ModemPowerState radioState) = 0;
|
||||
virtual void SetModemRadioPower(bool on, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void SetRadioStatus(int fun, int rst, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void GetRadioStatus(const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void ShutDown(const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual ModemPowerState GetRadioState() = 0;
|
||||
|
||||
virtual void Dial(std::string address, int clirMode, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void Reject(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void Hangup(int32_t gsmIndex, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void Answer(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void GetCallList(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
|
||||
virtual void Hold(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void Active(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void Swap(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void Join(int32_t callType, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void Split(int32_t nThCall, int32_t callType, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void CallSupplement(int32_t type, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void GetCallWait(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void SetCallWait(const int32_t activate, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void GetCallForward(int32_t reason, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void SetCallForward(int32_t reason, int32_t mode, std::string number, int32_t classx,
|
||||
const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void GetClip(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void SetClip(const int32_t action, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void GetClir(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void SetClir(const int32_t action, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void GetCallRestriction(std::string fac, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void SetCallRestriction(
|
||||
std::string &fac, int32_t mode, std::string &password, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void SendDtmf(const std::string &sDTMFCode, int32_t index, int32_t switchOn, int32_t switchOff,
|
||||
const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void SendDtmf(char cDTMFCode, int32_t index, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void StartDtmf(char cDTMFCode, int32_t index, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void StopDtmf(int32_t index, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void ActivatePdpContext(int32_t radioTechnology, CellularDataProfile dataProfile, bool isRoaming,
|
||||
bool allowRoaming, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void DeactivatePdpContext(
|
||||
@ -60,17 +78,43 @@ public:
|
||||
virtual void GetOperatorInfo(const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
|
||||
virtual void SendSms(std::string smscPdu, std::string pdu, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void StorageSms(
|
||||
int32_t status, std::string smscPdu, std::string pdu, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void DeleteSms(int32_t gsmIndex, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void UpdateSms(int32_t gsmIndex, int32_t state, std::string smscPdu, std::string pdu,
|
||||
const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
|
||||
virtual void GetSmsCenterAddress(const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void SetSmsCenterAddress(
|
||||
int32_t tosca, std::string address, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void SetCellBroadcast(int32_t mode, std::string idList, std::string dcsList,
|
||||
const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void SendSmsMoreMode(
|
||||
std::string smscPdu, std::string pdu, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void SendSmsAck(bool success, int32_t cause, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
|
||||
virtual void ReadIccFile(int32_t command, int32_t fileId, std::string path, int32_t p1, int32_t p2, int32_t p3,
|
||||
std::string data, std::string pin2, std::string aid, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void GetImsi(std::string aid, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void GetSimStatus(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void RequestSimIO(int32_t command, int32_t fileId, int32_t p1, int32_t p2, int32_t p3,
|
||||
std::string data, std::string path, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void GetImsi(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void GetIccID(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void GetSimLockStatus(std::string fac, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void SetSimLock(
|
||||
std::string fac, int32_t mode, std::string passwd, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void ChangeSimPassword(std::string fac, std::string oldPasswd, std::string newPasswd,
|
||||
int32_t pwdLength, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void EnterSimPin(std::string pin, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void UnlockSimPin(std::string puk, std::string pin, const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void GetSimPinInputTimes(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
|
||||
virtual void GetNetworkSearchInformation(const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void GetNetworkSelectionMode(const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void SetNetworkSelectionMode(
|
||||
int32_t automaticFlag, std::string oper, const AppExecFwk::InnerEvent::Pointer &response) = 0;
|
||||
virtual void SetNetworkLocationUpdate(const AppExecFwk::InnerEvent::Pointer &result) = 0;
|
||||
virtual void TelRilSetParam(int32_t preferredNetworkType, int32_t cdmaSubscription, int32_t instanceId) = 0;
|
||||
virtual bool InitCellularRadio(bool isFirst) = 0;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // CORE_SERVICE_IRIL_MANAGER_H
|
||||
#endif // I_TEL_RIL_MANAGER_H
|
||||
|
54
interfaces/innerkits/common/network_information.h
Normal file
54
interfaces/innerkits/common/network_information.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef NETWORK_INFORMATION_H
|
||||
#define NETWORK_INFORMATION_H
|
||||
|
||||
#include "parcel_base.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
typedef enum {
|
||||
NETWORK_PLMN_STATE_UNKNOWN = 0,
|
||||
NETWORK_PLMN_STATE_AVAILABLE = 1,
|
||||
NETWORK_PLMN_STATE_REGISTERED = 2,
|
||||
NETWORK_PLMN_STATE_FORBIDDEN = 3
|
||||
} NetworkPlmnState;
|
||||
|
||||
typedef enum { NETWORK_GSM_OR_GPRS = 0, NETWORK_WCDMA = 2, NETWORK_LTE = 7 } NetworkRat;
|
||||
|
||||
class NetworkInformation : public Parcelable {
|
||||
public:
|
||||
void SetOperateInformation(const std::string &operatorLongName, const std::string &operatorShortName,
|
||||
const std::string &operatorNumeric, int32_t state, int32_t rat_);
|
||||
int32_t GetNetworkState() const;
|
||||
std::string GetOperatorShortName() const;
|
||||
std::string GetOperatorLongName() const;
|
||||
std::string GetOperatorNumeric() const;
|
||||
int32_t GetRadioTech() const;
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
static NetworkInformation *Unmarshalling(Parcel &parcel);
|
||||
|
||||
private:
|
||||
NetworkPlmnState networkPlmnState_ = NETWORK_PLMN_STATE_UNKNOWN;
|
||||
std::string operatorShortName_;
|
||||
std::string operatorLongName_;
|
||||
std::string operatorNumeric_;
|
||||
NetworkRat rat_ = NETWORK_GSM_OR_GPRS;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // NETWORK_INFORMATION_H
|
40
interfaces/innerkits/common/network_search_result.h
Executable file
40
interfaces/innerkits/common/network_search_result.h
Executable file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef NETWORK_SEARCH_RESULT_H
|
||||
#define NETWORK_SEARCH_RESULT_H
|
||||
|
||||
#include "network_information.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class NetworkSearchResult : public Parcelable {
|
||||
public:
|
||||
NetworkSearchResult();
|
||||
virtual ~NetworkSearchResult() = default;
|
||||
void SetNetworkSearchResultValue(int32_t listSize, std::vector<NetworkInformation> &operatorInfo);
|
||||
std::vector<NetworkInformation> GetNetworkSearchResult() const;
|
||||
int32_t GetNetworkSearchResultSize() const;
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
static NetworkSearchResult *Unmarshalling(Parcel &parcel);
|
||||
|
||||
private:
|
||||
int32_t listSize_ = 0;
|
||||
std::vector<NetworkInformation> operatorInfoList_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // NETWORK_SEARCH_RESULT_H
|
@ -13,21 +13,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_NETWORK_STATE_H
|
||||
#define OHOS_NETWORK_STATE_H
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#ifndef NETWORK_STATE_H
|
||||
#define NETWORK_STATE_H
|
||||
|
||||
#include "parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
#define MSG_NS_SPN_UPDATED 0xF1
|
||||
const std::string SPN_INFO_UPDATED_ACTION = "ohos.action.telephonySpnInfoUpdated";
|
||||
const std::string CUR_PLMN = "CUR_PLMN";
|
||||
const std::string CUR_PLMN_SHOW = "CUR_PLMN_SHOW";
|
||||
const std::string CUR_SPN = "CUR_SPN";
|
||||
const std::string CUR_SPN_SHOW = "CUR_SPN_SHOW";
|
||||
const std::string CUR_REG_STATE = "CUR_REG_STATE";
|
||||
const std::string CUR_SPN_SHOW_RULE = "CUR_SPN_SHOW_RULE";
|
||||
|
||||
typedef enum {
|
||||
DOMAIN_TYPE_PS,
|
||||
DOMAIN_TYPE_CS,
|
||||
DOMAIN_TYPE_CS
|
||||
} DomainType;
|
||||
|
||||
typedef enum {
|
||||
@ -35,23 +39,25 @@ typedef enum {
|
||||
REG_STATE_IN_SERVICE,
|
||||
REG_STATE_NO_SERVICE,
|
||||
REG_STATE_EMERGENCY_ONLY,
|
||||
REG_STATE_SEARCH,
|
||||
REG_STATE_SEARCH
|
||||
} RegServiceState;
|
||||
|
||||
typedef enum {
|
||||
ROAMING_STATE_UNKNOWN,
|
||||
ROAMING_STATE_UNSPEC,
|
||||
ROAMING_STATE_HOME_ONLY,
|
||||
ROAMING_STATE_DOMESTIC,
|
||||
ROAMING_STATE_INTERNATIONAL,
|
||||
ROAMING_STATE_INTERNATIONAL
|
||||
} RoamingType;
|
||||
|
||||
typedef enum {
|
||||
RADIO_TECHNOLOGY_UNKNOWN,
|
||||
RADIO_TECHNOLOGY_GSM,
|
||||
RADIO_TECHNOLOGY_1XRTT,
|
||||
RADIO_TECHNOLOGY_WCDMA,
|
||||
RADIO_TECHNOLOGY_LTE
|
||||
} RadioTech;
|
||||
|
||||
typedef enum { MODE_TYPE_UNKNOWN = -1, MODE_TYPE_AUTO = 0, MODE_TYPE_MANUAL = 1 } SelectionMode;
|
||||
|
||||
const int NETWORK_MAX_NAME_LEN = 15;
|
||||
const int NETWORK_MAX_FULL_NAME_LEN = 31;
|
||||
const int NETWORK_MAX_PLMN_LEN = 31;
|
||||
@ -70,74 +76,71 @@ public:
|
||||
bool operator==(const NetworkState &other) const;
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
static std::unique_ptr<NetworkState> UnMarshalling(Parcel &parcel);
|
||||
static NetworkState *Unmarshalling(Parcel &parcel);
|
||||
void SetOperatorInfo(const std::string &longName, const std::string &shortName, const std::string &numeric,
|
||||
const DomainType domainType);
|
||||
DomainType domainType);
|
||||
void SetEmergency(bool isEmergency);
|
||||
void SetNetworkType(RadioTech tech, DomainType domainType);
|
||||
void SetRoaming(RoamingType roamingType, DomainType domainType);
|
||||
void SetNetworkState(RegServiceState state, DomainType domainType);
|
||||
int32_t GetPsRegStatus();
|
||||
int32_t GetCsRegStatus();
|
||||
|
||||
int32_t GetPsRegStatus() const;
|
||||
int32_t GetCsRegStatus() const;
|
||||
int32_t GetPsRoamingStatus() const;
|
||||
int32_t GetCsRoamingStatus() const;
|
||||
/*
|
||||
* Obtains RAT of the PS domain on the registered network.
|
||||
* @return Returns RAT of the PS domain on the registered network
|
||||
*/
|
||||
int32_t GetPsRadioTech();
|
||||
int32_t GetPsRadioTech() const;
|
||||
|
||||
/*
|
||||
* Obtains RAT of the CS domain on the registered network.
|
||||
* @return Returns RAT of the CS domain on the registered network
|
||||
*/
|
||||
int32_t GetCsRadioTech();
|
||||
int32_t GetCsRadioTech() const;
|
||||
|
||||
/*
|
||||
* Obtains the operator name in the long alphanumeric format of the registered network.
|
||||
* @return Returns operator name in the long alphanumeric format
|
||||
*/
|
||||
std::string GetLongOperatorName();
|
||||
std::string GetLongOperatorName() const;
|
||||
|
||||
/*
|
||||
* Obtains the operator name in the short alphanumeric format of the registered network.
|
||||
* @return Returns operator name in the short alphanumeric format
|
||||
*/
|
||||
std::string GetShortOperatorName();
|
||||
std::string GetShortOperatorName() const;
|
||||
|
||||
/*
|
||||
* Obtains the PLMN code of the registered network.
|
||||
* @return Returns the PLMN code
|
||||
*/
|
||||
std::string GetPlmnNumeric();
|
||||
std::string GetPlmnNumeric() const;
|
||||
|
||||
/*
|
||||
* Obtains the network registration status of the device.
|
||||
* @return Returns the network registration status
|
||||
*/
|
||||
int32_t GetRegStatus();
|
||||
|
||||
/*
|
||||
* Obtains the NSA network registration status of the device.
|
||||
* @return Returns the NSA network registration status
|
||||
*/
|
||||
int32_t GetNsaState();
|
||||
|
||||
/*
|
||||
* Obtains the status of CA.
|
||||
* @return Returns the status of CA.
|
||||
*/
|
||||
bool IsCaActive();
|
||||
int32_t GetRegStatus() const;
|
||||
|
||||
/*
|
||||
* Checks whether this device is allowed to make emergency calls only.
|
||||
* @return Returns the device emergency calls state.
|
||||
*/
|
||||
bool IsEmergency();
|
||||
bool IsEmergency() const;
|
||||
|
||||
/*
|
||||
* Checks whether the device is roaming.
|
||||
* @return Returns roaming state.
|
||||
*/
|
||||
bool IsRoaming();
|
||||
bool IsRoaming() const;
|
||||
|
||||
/*
|
||||
* Obtains the network plmn status
|
||||
* @return Returns the network plmn status
|
||||
*/
|
||||
int32_t GetNetworkPlmnState() const;
|
||||
std::string ToString() const;
|
||||
|
||||
private:
|
||||
bool isEmergency_;
|
||||
@ -150,5 +153,6 @@ private:
|
||||
RadioTech psRadioTech_;
|
||||
RadioTech csRadioTech_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_NS_NETWORK_STATE_H
|
||||
#endif // NETWORK_STATE_H
|
||||
|
147
interfaces/innerkits/common/observer_handler.h
Executable file → Normal file
147
interfaces/innerkits/common/observer_handler.h
Executable file → Normal file
@ -16,16 +16,12 @@
|
||||
#ifndef OBSERVER_HANDLER_H
|
||||
#define OBSERVER_HANDLER_H
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include "event_handler.h"
|
||||
#include "event_runner.h"
|
||||
#include "hilog/log.h"
|
||||
|
||||
static constexpr OHOS::HiviewDFX::HiLogLabel OBSERVER_LABEL = {LOG_CORE, 1, "ObserverHandler"};
|
||||
#include "telephony_log_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class ObserverHandler {
|
||||
public:
|
||||
ObserverHandler();
|
||||
@ -36,7 +32,7 @@ public:
|
||||
|
||||
void RegUniqueObserver(int what, const std::shared_ptr<AppExecFwk::EventHandler> handler);
|
||||
|
||||
void Remove(int what);
|
||||
void Remove(int what, const std::shared_ptr<AppExecFwk::EventHandler> handler);
|
||||
|
||||
void RemoveAll();
|
||||
|
||||
@ -47,13 +43,12 @@ public:
|
||||
{
|
||||
auto iter = observerHandlerMap_.find(what);
|
||||
if (iter == observerHandlerMap_.end()) {
|
||||
OHOS::HiviewDFX::HiLog::Info(OBSERVER_LABEL, "gesture %{public}d not register", what);
|
||||
TELEPHONY_LOGE("ObserverHandler NotifyObserver %{public}d not register", what);
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<T> msg(object);
|
||||
|
||||
for (auto handlers : iter->second) {
|
||||
OHOS::HiviewDFX::HiLog::Info(OBSERVER_LABEL, "zjy handlers->SendEvent:%{public}d", what);
|
||||
handlers->SendEvent(what, msg);
|
||||
}
|
||||
}
|
||||
@ -63,69 +58,123 @@ public:
|
||||
{
|
||||
auto iter = observerHandlerMap_.find(what);
|
||||
if (iter == observerHandlerMap_.end()) {
|
||||
OHOS::HiviewDFX::HiLog::Info(OBSERVER_LABEL, "NotifyObserver %{public}d not register", what);
|
||||
TELEPHONY_LOGE("ObserverHandler NotifyObserver %{public}d not register", what);
|
||||
return;
|
||||
}
|
||||
for (auto handlers : iter->second) {
|
||||
OHOS::HiviewDFX::HiLog::Info(OBSERVER_LABEL, "NotifyObserver handlers->SendEvent:%{public}d", what);
|
||||
handlers->SendEvent(what, object);
|
||||
}
|
||||
}
|
||||
|
||||
enum ObserverHandlerId {
|
||||
// modem
|
||||
RADIO_STATE_CHANGED = 0,
|
||||
RADIO_ON = 1,
|
||||
RADIO_AVAIL = 2,
|
||||
RADIO_OFF_OR_NOT_AVAIL = 3,
|
||||
RADIO_NOT_AVAIL = 4,
|
||||
RADIO_CALL_STATE = 5,
|
||||
RADIO_NETWORK_STATE = 6,
|
||||
RADIO_DATA_CALL_LIST_CHANGED = 7,
|
||||
RADIO_IMS_NETWORK_STATE_CHANGED = 8,
|
||||
RADIO_ICC_STATUS_CHANGED = 9,
|
||||
RADIO_CONNECTED = 10,
|
||||
RADIO_ICC_REFRESH = 11,
|
||||
RADIO_PCODATA = 12,
|
||||
RADIO_GET_SIGNAL_STRENGTH = 13,
|
||||
RADIO_GSM_SMS = 14,
|
||||
RADIO_SIGNAL_STRENGTH_UPDATE = 15,
|
||||
RADIO_SMS_ON_SIM = 16,
|
||||
RADIO_SMS_STATUS = 17,
|
||||
RADIO_RESTRICTED_STATE = 18,
|
||||
RADIO_GET_STATUS,
|
||||
RADIO_SET_STATUS,
|
||||
|
||||
// cellcall
|
||||
RADIO_DIAL = 19,
|
||||
RADIO_REJECT_CALL = 20,
|
||||
RADIO_HANDUP_CONNECT = 21,
|
||||
RADIO_ACCEPT_CALL = 22,
|
||||
RADIO_LAST_CALL_FAIL_CAUSE = 23,
|
||||
RADIO_CURRENT_CALLS = 24,
|
||||
RADIO_POWER,
|
||||
RADIO_ON,
|
||||
RADIO_AVAIL,
|
||||
RADIO_OFF,
|
||||
RADIO_NOT_AVAIL,
|
||||
RADIO_CALL_STATE,
|
||||
RADIO_DATA_CALL_LIST_CHANGED,
|
||||
RADIO_IMS_NETWORK_STATE_CHANGED,
|
||||
RADIO_ICC_STATUS_CHANGED,
|
||||
RADIO_CONNECTED,
|
||||
RADIO_ICC_REFRESH,
|
||||
RADIO_PCODATA,
|
||||
RADIO_GSM_SMS,
|
||||
|
||||
// Imssms
|
||||
RADIO_SEND_IMS_GSM_SMS = 25,
|
||||
RADIO_SEND_SMS = 26,
|
||||
RADIO_SEND_SMS_EXPECT_MORE = 27,
|
||||
RADIO_SMS_ON_SIM,
|
||||
RADIO_SMS_STATUS,
|
||||
RADIO_RESTRICTED_STATE,
|
||||
RADIO_CELL_BROADCAST,
|
||||
RADIO_RIL_SETUP_DATA_CALL,
|
||||
RADIO_RIL_IMS_REGISTRATION_STATE,
|
||||
RADIO_RIL_DEACTIVATE_DATA_CALL,
|
||||
|
||||
// data
|
||||
RADIO_POWER = 28,
|
||||
RADIO_VOICE_REG_STATE = 29,
|
||||
RADIO_DATA_REG_STATE = 30,
|
||||
RADIO_OPERATOR = 31,
|
||||
RADIO_RIL_SETUP_DATA_CALL = 32,
|
||||
RADIO_RIL_IMS_REGISTRATION_STATE = 33,
|
||||
RADIO_RIL_DEACTIVATE_DATA_CALL = 34,
|
||||
// cellular call
|
||||
RADIO_DIAL = 101,
|
||||
RADIO_REJECT_CALL,
|
||||
RADIO_HANGUP_CONNECT,
|
||||
RADIO_ACCEPT_CALL,
|
||||
RADIO_LAST_CALL_FAIL_CAUSE,
|
||||
RADIO_CURRENT_CALLS,
|
||||
RADIO_HOLD_CALL,
|
||||
RADIO_ACTIVE_CALL,
|
||||
RADIO_SWAP_CALL,
|
||||
RADIO_JOIN_CALL,
|
||||
RADIO_SPLIT_CALL,
|
||||
RADIO_CALL_SUPPLEMENT,
|
||||
RADIO_GET_CALL_WAIT,
|
||||
RADIO_SET_CALL_WAIT,
|
||||
RADIO_GET_CALL_FORWARD,
|
||||
RADIO_SET_CALL_FORWARD,
|
||||
RADIO_GET_CALL_CLIP,
|
||||
RADIO_SET_CALL_CLIP,
|
||||
RADIO_GET_CALL_CLIR,
|
||||
RADIO_SET_CALL_CLIR,
|
||||
RADIO_GET_CALL_RESTRICTION,
|
||||
RADIO_SET_CALL_RESTRICTION,
|
||||
RADIO_SEND_DTMF,
|
||||
RADIO_START_DTMF,
|
||||
RADIO_STOP_DTMF,
|
||||
|
||||
// Ims sms
|
||||
RADIO_SEND_IMS_GSM_SMS = 201,
|
||||
RADIO_SEND_SMS,
|
||||
RADIO_STORAGE_SMS,
|
||||
RADIO_DELETE_SMS,
|
||||
RADIO_SEND_SMS_EXPECT_MORE,
|
||||
|
||||
// Network Search
|
||||
RADIO_NETWORK_STATE = 301,
|
||||
RADIO_VOICE_REG_STATE,
|
||||
RADIO_DATA_REG_STATE,
|
||||
RADIO_OPERATOR,
|
||||
RADIO_GET_SIGNAL_STRENGTH,
|
||||
RADIO_SIGNAL_STRENGTH_UPDATE,
|
||||
RADIO_NETWORK_SEARCH_RESULT,
|
||||
RADIO_GET_NETWORK_SELECTION_MODE,
|
||||
RADIO_SET_NETWORK_SELECTION_MODE,
|
||||
RADIO_CELL_INFO_UPDATE,
|
||||
RADIO_GET_CELL_INFO,
|
||||
RADIO_GET_CELL_LOCATION,
|
||||
|
||||
// module internal events
|
||||
RADIO_PS_CONNECTION_ATTACHED = 500,
|
||||
RADIO_PS_CONNECTION_ATTACHED = 401,
|
||||
RADIO_PS_CONNECTION_DETACHED,
|
||||
RADIO_PS_ROAMING_OPEN,
|
||||
RADIO_PS_ROAMING_CLOSE,
|
||||
|
||||
// SIM
|
||||
RADIO_SIM_GET_STATUS = 501,
|
||||
RADIO_SIM_IO,
|
||||
RADIO_SIM_GET_IMSI,
|
||||
RADIO_SIM_GET_ICCID,
|
||||
RADIO_SIM_GET_LOCK_STATUS,
|
||||
RADIO_SIM_SET_LOCK,
|
||||
RADIO_SIM_CHANGE_PASSWD,
|
||||
RADIO_SIM_ENTER_PIN,
|
||||
RADIO_SIM_UNLOCK_PIN,
|
||||
RADIO_SIM_PIN_INPUT_TIMES,
|
||||
RADIO_SIM_STATE_CHANGE,
|
||||
RADIO_SIM_STATE_READY,
|
||||
RADIO_IMSI_LOADED_READY,
|
||||
RADIO_SIM_RECORDS_LOADED,
|
||||
RADIO_SIM_STATE_LOCKED,
|
||||
RADIO_SIM_STATE_SIMLOCK,
|
||||
|
||||
RADIO_UPDATE_SMS,
|
||||
RADIO_SET_SMS_CENTER_ADDRESS,
|
||||
RADIO_GET_SMS_CENTER_ADDRESS,
|
||||
RADIO_SET_CELL_BROADCAST
|
||||
};
|
||||
|
||||
private:
|
||||
std::unordered_map<int32_t, std::list<std::shared_ptr<AppExecFwk::EventHandler>>> observerHandlerMap_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // OBSERVER_HANDLER_H
|
||||
|
@ -12,16 +12,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef OHOS_RIL_COMMON_PARCEL_H
|
||||
#define OHOS_RIL_COMMON_PARCEL_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#ifndef OHOS_PARCEL_BASE_H
|
||||
#define OHOS_PARCEL_BASE_H
|
||||
|
||||
#include "parcel.h"
|
||||
#include "string_ex.h"
|
||||
#include "hril_types.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
#define READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(type, parcel, data) \
|
||||
do { \
|
||||
if (!(parcel).Read##type(data)) { \
|
||||
@ -35,19 +33,6 @@ namespace OHOS {
|
||||
return false; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
struct UniInfo : public Parcelable {
|
||||
int32_t serial;
|
||||
int32_t gsmIndex; /* Index of Global System for Mobile Communications */
|
||||
bool flag;
|
||||
int32_t arg1;
|
||||
int32_t arg2;
|
||||
std::string strTmp;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
std::shared_ptr<UniInfo> UnMarshalling(Parcel &parcel);
|
||||
void Dump(std::string, int32_t);
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_RIL_COMMON_PARCEL_H
|
||||
#endif // OHOS_PARCEL_BASE_H
|
@ -15,45 +15,45 @@
|
||||
|
||||
#ifndef UNTITLED_SIGNAL_INFORMATION_H
|
||||
#define UNTITLED_SIGNAL_INFORMATION_H
|
||||
|
||||
#include "parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
static constexpr int MAX_SIGNAL_NUM = 2;
|
||||
class SignalInformation : public Parcelable {
|
||||
public:
|
||||
enum class NetworkType { GSM = 1, CDMA, LTE, TDSCDMA };
|
||||
enum class NetworkType { GSM = 1, CDMA, LTE, TDSCDMA, WCDMA };
|
||||
static constexpr int NO_VALUE = 0x1AAAAAAA;
|
||||
static constexpr int GSM_SIGNAL_THRESHOLD_5BAR[] = {2, 4, 6, 8, 10, 12};
|
||||
static constexpr int CDMA_SIGNAL_THRESHOLD_5BAR[] = {-113, -112, -106, -99, -92, -85};
|
||||
static constexpr int EDVO_SIGNAL_THRESHOLD_5BAR[] = {-113, -112, -106, -99, -92, -85};
|
||||
static constexpr int LTE_SIGNAL_THRESHOLD_5BAR[] = {-121, -120, -115, -110, -105, -97};
|
||||
static constexpr int TDSCDMA_SIGNAL_THRESHOLD_5BAR[] = {-112, -111, -105, -99, -93, -87};
|
||||
static constexpr int GSM_SIGNAL_THRESHOLD_4BAR[] = {2, 3, 5, 8, 12};
|
||||
static constexpr int CDMA_SIGNAL_THRESHOLD_4BAR[] = {-113, -109, -101, -93, -85};
|
||||
static constexpr int EDVO_SIGNAL_THRESHOLD_4BAR[] = {-113, -109, -101, -93, -85};
|
||||
static constexpr int LTE_SIGNAL_THRESHOLD_4BAR[] = {-121, -120, -114, -107, -97};
|
||||
static constexpr int TDSCDMA_SIGNAL_THRESHOLD_4BAR[] = {-112, -111, -103, -95, -87};
|
||||
static const int *g_gsmSignalThreshold;
|
||||
static const int *g_cdmaSignalThreshold;
|
||||
static int g_signalBar;
|
||||
virtual SignalInformation::NetworkType GetNetworkType() const = 0;
|
||||
virtual bool Marshalling(Parcel &parcel) const = 0;
|
||||
static void InitSignalBar(const int32_t bar = 5);
|
||||
static std::unique_ptr<SignalInformation> UnMarshalling(Parcel &parcel);
|
||||
virtual bool ReadFromParcel(Parcel &parcel) = 0;
|
||||
virtual int32_t GetSignalLevel() const = 0;
|
||||
virtual std::string ToString() const = 0;
|
||||
virtual sptr<SignalInformation> NewInstance() const = 0;
|
||||
SignalInformation() = default;
|
||||
SignalInformation();
|
||||
virtual ~SignalInformation() = default;
|
||||
|
||||
protected:
|
||||
static int32_t signalBar_;
|
||||
static int32_t *gsmSignalThreshold_;
|
||||
static int32_t *cdmaSignalThreshold_;
|
||||
static int32_t *lteSignalThreshold_;
|
||||
static int32_t *wcdmaSignalThreshold_;
|
||||
};
|
||||
|
||||
class GsmSignalInformation : public SignalInformation {
|
||||
public:
|
||||
GsmSignalInformation();
|
||||
~GsmSignalInformation();
|
||||
void SetValue(const int32_t gsmRssi = 0, const int32_t timeAdvance = 0);
|
||||
GsmSignalInformation() = default;
|
||||
~GsmSignalInformation() = default;
|
||||
void SetValue(const int32_t gsmRssi = 0, const int32_t gsmBer = 0);
|
||||
bool operator==(const GsmSignalInformation &gsm) const;
|
||||
int32_t GetRssi() const;
|
||||
int32_t GetGsmBer() const;
|
||||
int32_t GetSignalLevel() const override;
|
||||
int32_t GetTimeAdvance() const;
|
||||
std::u16string ToString() const;
|
||||
std::string ToString() const override;
|
||||
sptr<SignalInformation> NewInstance() const override;
|
||||
SignalInformation::NetworkType GetNetworkType() const override;
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
@ -62,19 +62,19 @@ public:
|
||||
bool ValidateGsmValue() const;
|
||||
|
||||
private:
|
||||
int32_t gsmRssi_ = 0;
|
||||
int32_t timeAdvance_ = 0;
|
||||
int32_t gsmRxlev_ = 0;
|
||||
int32_t gsmBer_ = 0;
|
||||
};
|
||||
|
||||
class CdmaSignalInformation : public SignalInformation {
|
||||
public:
|
||||
CdmaSignalInformation();
|
||||
~CdmaSignalInformation();
|
||||
CdmaSignalInformation() = default;
|
||||
~CdmaSignalInformation() = default;
|
||||
void SetValue(const int32_t cdmaRssi = 0, const int32_t cdmaEcno = 0);
|
||||
bool operator==(const CdmaSignalInformation &cdma) const;
|
||||
int32_t GetCdmaRssi() const;
|
||||
int32_t GetSignalLevel() const override;
|
||||
std::u16string ToString() const;
|
||||
std::string ToString() const override;
|
||||
SignalInformation::NetworkType GetNetworkType() const override;
|
||||
sptr<SignalInformation> NewInstance() const override;
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
@ -87,5 +87,60 @@ private:
|
||||
int32_t cdmaRssi_ = -1;
|
||||
int32_t cdmaEcno_ = -1;
|
||||
};
|
||||
|
||||
class LteSignalInformation : public SignalInformation {
|
||||
public:
|
||||
LteSignalInformation() = default;
|
||||
~LteSignalInformation() = default;
|
||||
void SetValue(
|
||||
const int32_t rxlev = 0, const int32_t lteRsrp = 0, const int32_t lteRsrq = 0, const int32_t lteSnr = 0);
|
||||
bool operator==(const LteSignalInformation <e) const;
|
||||
int32_t GetRxlev() const;
|
||||
int32_t GetRsrp() const;
|
||||
int32_t GetRsrq() const;
|
||||
int32_t GetSnr() const;
|
||||
int32_t GetSignalLevel() const override;
|
||||
std::string ToString() const override;
|
||||
SignalInformation::NetworkType GetNetworkType() const override;
|
||||
sptr<SignalInformation> NewInstance() const override;
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
static std::unique_ptr<LteSignalInformation> UnMarshalling(Parcel &parcel);
|
||||
bool ReadFromParcel(Parcel &parcel) override;
|
||||
bool ValidateLteValue() const;
|
||||
|
||||
private:
|
||||
int32_t rxlev_ = 0;
|
||||
int32_t lteRsrp_ = 0;
|
||||
int32_t lteRsrq_ = 0;
|
||||
int32_t lteSnr_ = 0;
|
||||
};
|
||||
|
||||
class WcdmaSignalInformation : public SignalInformation {
|
||||
public:
|
||||
WcdmaSignalInformation() = default;
|
||||
~WcdmaSignalInformation() = default;
|
||||
void SetValue(const int32_t wcdmaRxlev = 0, const int32_t wcdmaRscp = 0, const int32_t wcdmaEcio = 0,
|
||||
const int32_t wcdmaBer = 0);
|
||||
bool operator==(const WcdmaSignalInformation &wcdma) const;
|
||||
int32_t GetRxlev() const;
|
||||
int32_t GetRscp() const;
|
||||
int32_t GetEcno() const;
|
||||
int32_t GetBer() const;
|
||||
int32_t GetSignalLevel() const override;
|
||||
std::string ToString() const override;
|
||||
SignalInformation::NetworkType GetNetworkType() const override;
|
||||
sptr<SignalInformation> NewInstance() const override;
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
static std::unique_ptr<WcdmaSignalInformation> UnMarshalling(Parcel &parcel);
|
||||
bool ReadFromParcel(Parcel &parcel) override;
|
||||
bool ValidateWcdmaValue() const;
|
||||
|
||||
private:
|
||||
int32_t wcdmaRxlev_ = 0;
|
||||
int32_t wcdmaRscp_ = 0;
|
||||
int32_t wcdmaEcio_ = 0;
|
||||
int32_t wcdmaBer_ = 0;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // UNTITLED_SIGNAL_INFORMATION_H
|
||||
|
@ -15,10 +15,13 @@
|
||||
|
||||
#ifndef TELEPHONY_TELEPHONY_ERRORS_H
|
||||
#define TELEPHONY_TELEPHONY_ERRORS_H
|
||||
|
||||
#include <errors.h>
|
||||
|
||||
namespace OHOS {
|
||||
const int TELEPHONY_NO_ERROR = 0;
|
||||
namespace Telephony {
|
||||
const int TELEPHONY_ERROR = -1;
|
||||
const int TELEPHONY_SUCCESS = 0;
|
||||
|
||||
enum {
|
||||
TELEPHONY_COMMON = 0x00,
|
||||
@ -31,6 +34,7 @@ enum {
|
||||
TELEPHONY_CORE_SERVICE_SIM = 0x07,
|
||||
TELEPHONY_CORE_SERVICE_NETWORK_SEARCH = 0x08,
|
||||
TELEPHONY_CORE_SERVICE_CORE = 0x09,
|
||||
TELEPHONY_DATA_STORAGE = 0x10,
|
||||
};
|
||||
|
||||
// Error code for common
|
||||
@ -45,12 +49,10 @@ enum {
|
||||
TELEPHONY_MEMSET_FAIL,
|
||||
TELEPHONY_LOCAL_PTR_NULL,
|
||||
TELEPHONY_LOCAL_STORAGE_EMPTY,
|
||||
TELEPHONY_BINDER_PID_MISMATCH,
|
||||
TELEPHONY_BINDER_UID_MISMATCH,
|
||||
TELEPHONY_SOCKET_ERR,
|
||||
TELEPHONY_PERMISSION_ERR,
|
||||
TELEPHONY_BAD_TYPE,
|
||||
TELEPHONY_WRITE_DISCRIPTOR_TOKEN_FAIL,
|
||||
TELEPHONY_WRITE_DESCRIPTOR_TOKEN_FAIL,
|
||||
TELEPHONY_WRITE_REPLY_FAIL,
|
||||
TELEPHONY_CONNECT_SYSTEM_ABILITY_STUB_FAIL,
|
||||
TELEPHONY_ADD_DEATH_RECIPIENT_FAIL,
|
||||
@ -58,10 +60,10 @@ enum {
|
||||
};
|
||||
|
||||
// Error code for telephony call manager
|
||||
constexpr ErrCode CALL_MANAGER_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CALL_MANAGER);
|
||||
constexpr ErrCode CALL_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CALL_MANAGER);
|
||||
|
||||
// Error code for telephony cellular call
|
||||
constexpr ErrCode CELLULAR_CALL_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CELLULAR_CALL);
|
||||
constexpr ErrCode PROTOCOL_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CELLULAR_CALL);
|
||||
|
||||
// Error code for telephony cellular data
|
||||
constexpr ErrCode CELLULAR_DATA_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CELLULAR_DATA);
|
||||
@ -84,5 +86,9 @@ constexpr ErrCode CORE_SERVICE_NETWORK_SEARCH_ERR_OFFSET =
|
||||
|
||||
// Error code for telephony core of core service
|
||||
constexpr ErrCode CORE_SERVICE_CORE_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CORE_SERVICE_CORE);
|
||||
|
||||
// Error code for telephony data storage
|
||||
constexpr ErrCode CORE_DATA_STORAGE_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_DATA_STORAGE);
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // TELEPHONY_TELEPHONY_ERRORS_H
|
4
tel_ril/include/telephony_log.h → interfaces/innerkits/common/telephony_log.h
Normal file → Executable file
4
tel_ril/include/telephony_log.h → interfaces/innerkits/common/telephony_log.h
Normal file → Executable file
@ -12,12 +12,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TELEPHONY_LOG_H
|
||||
#define TELEPHONY_LOG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "hilog/log.h"
|
||||
|
||||
#undef LOG_DOMAIN
|
||||
#undef LOG_TAG
|
||||
#define LOG_DOMAIN 0xD002B01
|
52
interfaces/innerkits/data_storage/common/call_history_data.h
Normal file
52
interfaces/innerkits/data_storage/common/call_history_data.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef DATA_STORAGE_CALL_HISTORY_H
|
||||
#define DATA_STORAGE_CALL_HISTORY_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
const std::string CALL_ID = "call_id";
|
||||
const std::string PHONE_NUMBER = "phone_number";
|
||||
const std::string CALL_TYPE = "call_type";
|
||||
const std::string SESSION_TYPE = "session_type";
|
||||
const std::string START_TIME = "start_time";
|
||||
const std::string END_TIME = "end_time";
|
||||
const std::string CALL_DURATION_TIME = "call_duration_time";
|
||||
const std::string CALL_STATE = "call_state";
|
||||
const std::string COUNTRY_CODE = "country_code";
|
||||
|
||||
struct CallHistoryInfo {
|
||||
int callId;
|
||||
std::string phoneNumber;
|
||||
int callType;
|
||||
int sessionType;
|
||||
std::string startTime;
|
||||
std::string endTime;
|
||||
long durationTime;
|
||||
int callState;
|
||||
std::string countryCode;
|
||||
};
|
||||
|
||||
enum class SessionType : int { UNKNOWN = 0, CS, IMS, OTT };
|
||||
|
||||
enum class CallType : int { UNKNOWN = 0, INCOMING, CALLING };
|
||||
|
||||
enum class CallState : int { UNKNOWN = 0, REJECT, MISSED, ONLINE, PAUSE, COMPLETE };
|
||||
|
||||
const std::string uri = "dataability://telephony.callhistory";
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // DATA_STORAGE_CALL_HISTORY_H
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef STATE_REGISTRY_ERRORS_H
|
||||
#define STATE_REGISTRY_ERRORS_H
|
||||
|
||||
#include "../../../core_service/interfaces/innerkits/common/telephony_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
enum {
|
||||
OPEN_FILE_ERROR = CORE_DATA_STORAGE_ERR_OFFSET,
|
||||
TEL_PROFILE_UTIL_IS_NULL,
|
||||
PDP_PROFILE_VERSION_IS_NULL,
|
||||
PDP_PROFILE_VERSION_IS_OLD,
|
||||
OPERATOR_IS_NULL,
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // STATE_REGISTRY_ERRORS_H
|
93
interfaces/innerkits/data_storage/common/message_data.h
Normal file
93
interfaces/innerkits/data_storage/common/message_data.h
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef DATA_STORAGE_SMS_DATA_H
|
||||
#define DATA_STORAGE_SMS_DATA_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
const std::string MSG_ID = "msg_id";
|
||||
const std::string RECEIVER_NUMBER = "receiver_number";
|
||||
const std::string SENDER_NUMBER = "sender_number";
|
||||
const std::string START_TIME = "start_time";
|
||||
const std::string END_TIME = "end_time";
|
||||
const std::string MSG_TYPE = "msg_type";
|
||||
const std::string MSG_TITLE = "msg_title";
|
||||
const std::string MSG_CONTENT = "msg_content";
|
||||
const std::string MSG_STATE = "msg_state";
|
||||
const std::string MSG_CODE = "msg_code";
|
||||
const std::string IS_LOCK = "is_lock";
|
||||
const std::string IS_READ = "is_read";
|
||||
const std::string IS_COLLECT = "is_collect";
|
||||
const std::string SESSION_TYPE = "session_type";
|
||||
const std::string RETRY_NUMBER = "retry_number";
|
||||
const std::string ATTACHMENT_TYPE = "attachment_type";
|
||||
const std::string ATTACHMENT_PATH = "attachment_path";
|
||||
const std::string ATTACHMENT_FAILURE_TIME = "attachment_failure_time";
|
||||
const std::string OPERATOR_SERVICE_NUMBER = "operator_service_number";
|
||||
const std::string SESSION_ID = "session_id";
|
||||
const std::string GROUP_ID = "group_id";
|
||||
const std::string PDU_ID = "pdu_id";
|
||||
|
||||
struct MessageInfo {
|
||||
int msgId;
|
||||
std::string receiverNumber;
|
||||
std::string senderNumber;
|
||||
std::string startTime;
|
||||
std::string endTime;
|
||||
int msgType;
|
||||
std::string msgTitle;
|
||||
std::string msgContent;
|
||||
int msgState;
|
||||
std::string operatorServiceNumber;
|
||||
int msgCode;
|
||||
int isLock;
|
||||
int isRead;
|
||||
int isCollect;
|
||||
int sessionType;
|
||||
int retryNumber;
|
||||
int attachmentType;
|
||||
std::string attachmentPath;
|
||||
std::string attachmentFailureTime;
|
||||
int pdu_id;
|
||||
int sessionId;
|
||||
int groupId;
|
||||
};
|
||||
|
||||
enum MsgType { SMS = 0, MMS };
|
||||
|
||||
enum MsgState { UNSENT = 0, FAILED, PENDING, SUCCEED };
|
||||
|
||||
const std::string uri = "dataability://telephony.sms";
|
||||
|
||||
enum class MessageUriType : int32_t {
|
||||
ALL,
|
||||
MMS,
|
||||
SMS,
|
||||
UNREAD,
|
||||
READ,
|
||||
UNLOCK,
|
||||
LOCK,
|
||||
COLLECT,
|
||||
CANCEL_COLLECT,
|
||||
DELETE_BY_IDS,
|
||||
DELETE_THIRTY_DATA,
|
||||
SELECT_BY_NUMBER,
|
||||
SELECT_COLLECT_DATA,
|
||||
MARK_READ
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // DATA_STORAGE_SMS_DATA_H
|
86
interfaces/innerkits/data_storage/common/pdp_profile_data.h
Normal file
86
interfaces/innerkits/data_storage/common/pdp_profile_data.h
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef DATA_STORAGE_PDP_PROFILE_DATA_H
|
||||
#define DATA_STORAGE_PDP_PROFILE_DATA_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
const std::string PROFILE_ID = "profile_id";
|
||||
const std::string PROFILE_NAME = "profile_name";
|
||||
const std::string MCC = "mcc";
|
||||
const std::string MNC = "mnc";
|
||||
const std::string APN = "apn";
|
||||
const std::string AUTH_TYPE = "auth_type";
|
||||
const std::string AUTH_USER = "auth_user";
|
||||
const std::string AUTH_PWD = "auth_pwd";
|
||||
const std::string APN_TYPES = "apn_types";
|
||||
const std::string IS_ROAMING_APN = "is_roaming_apn";
|
||||
const std::string PROFILE_ENABLE = "profile_enable";
|
||||
const std::string HOME_URL = "home_url";
|
||||
const std::string PROXY_IP_ADDRESS = "proxy_ip_address";
|
||||
const std::string MMS_IP_ADDRESS = "mms_ip_address";
|
||||
const std::string APN_PROTOCOL = "apn_protocol";
|
||||
const std::string APN_ROAM_PROTOCOL = "apn_roam_protocol";
|
||||
const std::string BEARING_SYSTEM_TYPE = "bearing_system_type";
|
||||
|
||||
struct PdpProfileInfo {
|
||||
int profileId;
|
||||
std::string profileName;
|
||||
std::string mcc;
|
||||
std::string mnc;
|
||||
std::string apn;
|
||||
int authType;
|
||||
std::string authUser;
|
||||
std::string authPwd;
|
||||
std::string apnTypes; // see ApnType
|
||||
int isRoamingApn;
|
||||
std::string homeUrl;
|
||||
std::string proxyIpAddress;
|
||||
std::string mmsIpAddress;
|
||||
std::string pdpProtocol; // see PdpProtocol
|
||||
std::string roamPdpProtocol;
|
||||
int bearingSystemType; // see BearingSystemType
|
||||
};
|
||||
|
||||
enum ApnType { DEFAULT, IMS, MMS, ALL };
|
||||
|
||||
enum ApnAuthType { None = 0, PAP, CHAP, PAP_OR_CHAP };
|
||||
|
||||
enum PdpProtocol { IPV4 = 0, IPV6, IPV4V6 };
|
||||
|
||||
enum BearingSystemType {
|
||||
UNKNOWN = 0,
|
||||
LTE,
|
||||
HSPAP,
|
||||
HSPA,
|
||||
HSUPA,
|
||||
HSDPA,
|
||||
UMTS,
|
||||
EDGE,
|
||||
GPRS,
|
||||
eHRPD,
|
||||
EVDO_B,
|
||||
EVDO_A,
|
||||
EVDO_0,
|
||||
xRTT,
|
||||
IS95B,
|
||||
IS95AS
|
||||
};
|
||||
|
||||
const std::string uri = "dataability://telephony.pdpprofile";
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // DATA_STORAGE_PDP_PROFILE_DATA_H
|
58
interfaces/innerkits/data_storage/common/sim_data.h
Normal file
58
interfaces/innerkits/data_storage/common/sim_data.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef DATA_STORAGE_SIM_DATA_H
|
||||
#define DATA_STORAGE_SIM_DATA_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
const std::string SIM_ID = "sim_id";
|
||||
const std::string ICC_ID = "icc_id";
|
||||
const std::string CARD_ID = "card_id";
|
||||
const std::string SLOT_INDEX = "slot_index";
|
||||
const std::string SHOW_NAME = "show_name";
|
||||
const std::string PHONE_NUMBER = "phone_number";
|
||||
const std::string COUNTRY_CODE = "country_code";
|
||||
const std::string LANGUAGE = "language";
|
||||
const std::string IMSI = "imsi";
|
||||
const std::string CARD_TYPE = "card_type";
|
||||
const std::string IS_ACTIVE = "is_active";
|
||||
const std::string IS_MAIN_CARD = "is_main_card";
|
||||
const std::string IS_MESSAGE_CARD = "is_message_card";
|
||||
const std::string IS_CELLULAR_DATA_CARD = "is_cellular_data_card";
|
||||
|
||||
struct SimInfo {
|
||||
int simId;
|
||||
std::string iccId;
|
||||
std::string cardId;
|
||||
int slotIndex;
|
||||
int cardType;
|
||||
std::string showName;
|
||||
std::string phoneNumber;
|
||||
std::string countryCode;
|
||||
std::string language;
|
||||
std::string imsi;
|
||||
int isMainCard;
|
||||
int isMessageCard;
|
||||
int isCellularDataCard;
|
||||
int isActive;
|
||||
};
|
||||
|
||||
const std::string SIM_URI = "dataability://telephony.sim";
|
||||
|
||||
enum SimUriType { ALL, MAIN_CARD, CELLULAR_DATA_CARD, MESSAGE_CARD, CURRENT, ID, DELETE, UPDATE, INSERT };
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // DATA_STORAGE_SIM_DATA_H
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef NETWORK_SEARCH_SERVICE_DEATH_RECIPIENT_H
|
||||
#define NETWORK_SEARCH_SERVICE_DEATH_RECIPIENT_H
|
||||
|
||||
#include "iremote_object.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class NetworkSearchServiceDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
public:
|
||||
NetworkSearchServiceDeathRecipient() = default;
|
||||
virtual ~NetworkSearchServiceDeathRecipient() = default;
|
||||
virtual void OnRemoteDied(const wptr<IRemoteObject> &remote) override;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // NETWORK_SEARCH_SERVICE_DEATH_RECIPIENT_H
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef NETWORK_SEARCH_SERVICE_PROXY_HOLDER_H
|
||||
#define NETWORK_SEARCH_SERVICE_PROXY_HOLDER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include "i_core_service.h"
|
||||
#include "iremote_object.h"
|
||||
#include "refbase.h"
|
||||
#include "signal_information.h"
|
||||
#include "network_search_result.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class NetworkSearchServiceProxyHolder {
|
||||
public:
|
||||
int32_t GetPsRadioTech(int32_t slotId);
|
||||
int32_t GetCsRadioTech(int32_t slotId);
|
||||
std::vector<sptr<SignalInformation>> GetSignalInfoList(int32_t slotId);
|
||||
std::u16string GetOperatorNumeric(int32_t slotId);
|
||||
std::u16string GetOperatorName(int32_t slotId);
|
||||
sptr<NetworkState> GetNetworkState(int32_t slotId);
|
||||
bool GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback);
|
||||
bool SetNetworkSelectionMode(int32_t slotId, int32_t selectMode,
|
||||
const sptr<NetworkInformation> networkInformation, bool resumeSelection,
|
||||
const sptr<INetworkSearchCallback> &callback);
|
||||
bool GetNetworkSearchResult(int32_t slotId, const sptr<INetworkSearchCallback> &callback);
|
||||
bool SetRadioState(int32_t slotId, bool isOn, const sptr<INetworkSearchCallback> &callback);
|
||||
bool GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback);
|
||||
std::u16string GetIsoCountryCodeForNetwork(int32_t slotId);
|
||||
bool GetNetworkSearchProxy();
|
||||
void ResetNetworkServiceServiceProxy();
|
||||
|
||||
private:
|
||||
std::mutex mutex_;
|
||||
sptr<ICoreService> radioNetworkService_;
|
||||
sptr<IRemoteObject::DeathRecipient> recipient_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // NETWORK_SEARCH_PROXY_HOLDER_H
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#include "network_search_service_death_recipient.h"
|
||||
#include "network_search_service_proxy_holder.h"
|
||||
#include "singleton.h"
|
||||
#include "telephony_log_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
void NetworkSearchServiceDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
TELEPHONY_LOGI("network search service died,remove the proxy object");
|
||||
DelayedSingleton<NetworkSearchServiceProxyHolder>::GetInstance()->ResetNetworkServiceServiceProxy();
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#include "network_search_service_proxy_holder.h"
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "network_search_service_death_recipient.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "telephony_log_wrapper.h"
|
||||
#include "telephony_napi_common_error.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
bool NetworkSearchServiceProxyHolder::GetNetworkSearchProxy()
|
||||
{
|
||||
TELEPHONY_LOGI("start");
|
||||
if (!radioNetworkService_) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
sptr<ISystemAbilityManager> systemAbilityManager =
|
||||
SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (!systemAbilityManager) {
|
||||
TELEPHONY_LOGE(" Get system ability mgr failed.");
|
||||
return false;
|
||||
}
|
||||
sptr<IRemoteObject> remoteObject =
|
||||
systemAbilityManager->GetSystemAbility(TELEPHONY_CORE_SERVICE_SYS_ABILITY_ID);
|
||||
if (!remoteObject) {
|
||||
TELEPHONY_LOGE("Get Telephony Core Service Failed.");
|
||||
return false;
|
||||
}
|
||||
radioNetworkService_ = iface_cast<ICoreService>(remoteObject);
|
||||
if ((!radioNetworkService_) || (!radioNetworkService_->AsObject())) {
|
||||
TELEPHONY_LOGE("Get Telephony Core Proxy Failed.");
|
||||
return false;
|
||||
}
|
||||
recipient_ = new NetworkSearchServiceDeathRecipient();
|
||||
if (!recipient_) {
|
||||
TELEPHONY_LOGE("Failed to create death Recipient ptr NetworkSearchServiceDeathRecipient!");
|
||||
return false;
|
||||
}
|
||||
radioNetworkService_->AsObject()->AddDeathRecipient(recipient_);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void NetworkSearchServiceProxyHolder::ResetNetworkServiceServiceProxy()
|
||||
{
|
||||
TELEPHONY_LOGI("start");
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
if ((radioNetworkService_ != nullptr) && (radioNetworkService_->AsObject() != nullptr)) {
|
||||
radioNetworkService_->AsObject()->RemoveDeathRecipient(recipient_);
|
||||
}
|
||||
radioNetworkService_ = nullptr;
|
||||
}
|
||||
|
||||
int32_t NetworkSearchServiceProxyHolder::GetPsRadioTech(int32_t slotId)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->GetPsRadioTech(slotId);
|
||||
}
|
||||
return ERROR_SERVICE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
int32_t NetworkSearchServiceProxyHolder::GetCsRadioTech(int32_t slotId)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->GetCsRadioTech(slotId);
|
||||
}
|
||||
return ERROR_SERVICE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
std::vector<sptr<SignalInformation>> NetworkSearchServiceProxyHolder::GetSignalInfoList(int32_t slotId)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->GetSignalInfoList(slotId);
|
||||
}
|
||||
return std::vector<sptr<SignalInformation>>();
|
||||
}
|
||||
|
||||
std::u16string NetworkSearchServiceProxyHolder::GetOperatorNumeric(int32_t slotId)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->GetOperatorNumeric(slotId);
|
||||
}
|
||||
return u"";
|
||||
}
|
||||
|
||||
std::u16string NetworkSearchServiceProxyHolder::GetOperatorName(int32_t slotId)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->GetOperatorName(slotId);
|
||||
}
|
||||
return u"";
|
||||
}
|
||||
|
||||
sptr<NetworkState> NetworkSearchServiceProxyHolder::GetNetworkState(int32_t slotId)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return sptr<NetworkState>(radioNetworkService_->GetNetworkState(slotId));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool NetworkSearchServiceProxyHolder::GetNetworkSelectionMode(
|
||||
int32_t slotId, const sptr<INetworkSearchCallback> &callback)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->GetNetworkSelectionMode(slotId, callback);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NetworkSearchServiceProxyHolder::SetNetworkSelectionMode(int32_t slotId, int32_t selectMode,
|
||||
const sptr<NetworkInformation> networkInformation, bool resumeSelection,
|
||||
const sptr<INetworkSearchCallback> &callback)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->SetNetworkSelectionMode(
|
||||
slotId, selectMode, networkInformation, resumeSelection, callback);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NetworkSearchServiceProxyHolder::SetRadioState(
|
||||
int32_t slotId, bool isOn, const sptr<INetworkSearchCallback> &callback)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->SetRadioState(slotId, isOn, callback);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NetworkSearchServiceProxyHolder::GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->GetRadioState(slotId, callback);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NetworkSearchServiceProxyHolder::GetNetworkSearchResult(
|
||||
int32_t slotId, const sptr<INetworkSearchCallback> &callback)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->GetNetworkSearchResult(slotId, callback);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::u16string NetworkSearchServiceProxyHolder::GetIsoCountryCodeForNetwork(int32_t slotId)
|
||||
{
|
||||
if (GetNetworkSearchProxy()) {
|
||||
return radioNetworkService_->GetIsoCountryCodeForNetwork(slotId);
|
||||
}
|
||||
return u"";
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
File diff suppressed because it is too large
Load Diff
@ -15,35 +15,63 @@
|
||||
|
||||
#ifndef BASE_PHONE_SERVICE_PROXY_H
|
||||
#define BASE_PHONE_SERVICE_PROXY_H
|
||||
#include <iremote_proxy.h>
|
||||
|
||||
#include "i_core_service.h"
|
||||
#include "telephony_errors.h"
|
||||
#include "telephony_log_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class CoreServiceProxy : public IRemoteProxy<ICoreService> {
|
||||
public:
|
||||
explicit CoreServiceProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<ICoreService>(impl) {}
|
||||
virtual ~CoreServiceProxy() = default;
|
||||
|
||||
int32_t GetPsRadioTech(int32_t slotId) override;
|
||||
int32_t GetCsRadioTech(int32_t slotId) override;
|
||||
std::vector<sptr<SignalInformation>> GetSignalInfoList(int32_t slotId) override;
|
||||
std::u16string GetOperatorNumeric(int32_t slotId) override;
|
||||
std::u16string GetOperatorName(int32_t slotId) override;
|
||||
const sptr<NetworkState> GetNetworkStatus(int32_t slotId) override;
|
||||
void SetHRilRadioState(int32_t slotId, bool isOn) override;
|
||||
int32_t GetRadioState(int32_t slotId) override;
|
||||
|
||||
const sptr<NetworkState> GetNetworkState(int32_t slotId) override;
|
||||
bool SetRadioState(int32_t slotId, bool isOn, const sptr<INetworkSearchCallback> &callback) override;
|
||||
bool GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback) override;
|
||||
bool HasSimCard(int32_t slotId) override;
|
||||
int32_t GetSimState(int32_t slotId) override;
|
||||
std::u16string GetSimOperator(int32_t slotId) override;
|
||||
std::u16string GetIsoCountryCode(int32_t slotId) override;
|
||||
std::u16string GetSpn(int32_t slotId) override;
|
||||
std::u16string GetIccId(int32_t slotId) override;
|
||||
std::u16string GetSimOperatorNumeric(int32_t slotId) override;
|
||||
std::u16string GetIsoCountryCodeForSim(int32_t slotId) override;
|
||||
std::u16string GetSimSpn(int32_t slotId) override;
|
||||
std::u16string GetSimIccId(int32_t slotId) override;
|
||||
std::u16string GetIMSI(int32_t slotId) override;
|
||||
bool IsSimActive(int32_t slotId) override;
|
||||
bool GetNetworkSearchResult(int32_t slotId, const sptr<INetworkSearchCallback> &callback) override;
|
||||
bool GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback) override;
|
||||
std::u16string GetLocaleFromDefaultSim() override;
|
||||
std::u16string GetSimGid1(int32_t slotId) override;
|
||||
bool SetNetworkSelectionMode(int32_t slotId, int32_t selectMode,
|
||||
const sptr<NetworkInformation> &networkInformation, bool resumeSelection,
|
||||
const sptr<INetworkSearchCallback> &callback) override;
|
||||
std::u16string GetIsoCountryCodeForNetwork(int32_t slotId) override;
|
||||
bool GetSimAccountInfo(int32_t subId, IccAccountInfo &info) override;
|
||||
bool SetDefaultVoiceSlotId(int32_t subId) override;
|
||||
int32_t GetDefaultVoiceSlotId() override;
|
||||
bool IsValidSimId(int32_t subId);
|
||||
|
||||
bool UnlockPin(std::u16string pin, LockStatusResponse &response, int32_t phoneId) override;
|
||||
bool UnlockPuk(
|
||||
std::u16string newPin, std::u16string puk, LockStatusResponse &response, int32_t phoneId) override;
|
||||
bool AlterPin(
|
||||
std::u16string newPin, std::u16string oldPin, LockStatusResponse &response, int32_t phoneId) override;
|
||||
bool SetLockState(std::u16string pin, int32_t enable, LockStatusResponse &response, int32_t phoneId) override;
|
||||
int32_t GetLockState(int32_t phoneId) override;
|
||||
int32_t RefreshSimState(int32_t slotId) override;
|
||||
|
||||
private:
|
||||
bool WriteInterfaceToken(MessageParcel &data);
|
||||
void ProcessSignalInfo(MessageParcel &reply, std::vector<sptr<SignalInformation>> &result);
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<CoreServiceProxy> delegator_;
|
||||
std::mutex mutex_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // BASE_PHONE_SERVICE_PROXY_H
|
||||
|
@ -16,33 +16,57 @@
|
||||
#ifndef I_BASE_PHONE_SERVICE_H
|
||||
#define I_BASE_PHONE_SERVICE_H
|
||||
|
||||
#include <iremote_broker.h>
|
||||
#include "i_network_search_callback.h"
|
||||
#include "i_sim_manager.h"
|
||||
#include "i_sim_state_manager.h"
|
||||
#include "network_search_result.h"
|
||||
#include "network_state.h"
|
||||
#include "signal_information.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class ICoreService : public IRemoteBroker {
|
||||
public:
|
||||
virtual ~ICoreService() = default;
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.telephony.ICoreService");
|
||||
|
||||
public:
|
||||
virtual ~ICoreService() = default;
|
||||
virtual int32_t GetPsRadioTech(int32_t slotId) = 0;
|
||||
virtual int32_t GetCsRadioTech(int32_t slotId) = 0;
|
||||
virtual std::u16string GetOperatorNumeric(int32_t slotId) = 0;
|
||||
virtual std::u16string GetOperatorName(int32_t slotId) = 0;
|
||||
virtual std::vector<sptr<SignalInformation>> GetSignalInfoList(int32_t slotId) = 0;
|
||||
virtual const sptr<NetworkState> GetNetworkStatus(int32_t slotId) = 0;
|
||||
virtual void SetHRilRadioState(int32_t slotId, bool isOn) = 0;
|
||||
virtual int32_t GetRadioState(int32_t slotId) = 0;
|
||||
|
||||
virtual const sptr<NetworkState> GetNetworkState(int32_t slotId) = 0;
|
||||
virtual bool SetRadioState(int32_t slotId, bool isOn, const sptr<INetworkSearchCallback> &callback) = 0;
|
||||
virtual bool GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
|
||||
virtual bool HasSimCard(int32_t slotId) = 0;
|
||||
virtual int32_t GetSimState(int32_t slotId) = 0;
|
||||
virtual std::u16string GetSimOperator(int32_t slotId) = 0;
|
||||
virtual std::u16string GetIsoCountryCode(int32_t slotId) = 0;
|
||||
virtual std::u16string GetSpn(int32_t slotId) = 0;
|
||||
virtual std::u16string GetIccId(int32_t slotId) = 0;
|
||||
virtual bool UnlockPin(std::u16string pin, LockStatusResponse &response, int32_t phoneId) = 0;
|
||||
virtual bool UnlockPuk(
|
||||
std::u16string newPin, std::u16string puk, LockStatusResponse &response, int32_t phoneId) = 0;
|
||||
virtual bool AlterPin(
|
||||
std::u16string newPin, std::u16string oldPin, LockStatusResponse &response, int32_t phoneId) = 0;
|
||||
virtual bool SetLockState(
|
||||
std::u16string pin, int32_t enable, LockStatusResponse &response, int32_t phoneId) = 0;
|
||||
virtual int32_t GetLockState(int32_t phoneId) = 0;
|
||||
virtual std::u16string GetSimOperatorNumeric(int32_t slotId) = 0;
|
||||
virtual std::u16string GetIsoCountryCodeForSim(int32_t slotId) = 0;
|
||||
virtual std::u16string GetSimSpn(int32_t slotId) = 0;
|
||||
virtual std::u16string GetSimIccId(int32_t slotId) = 0;
|
||||
virtual std::u16string GetIMSI(int32_t slotId) = 0;
|
||||
virtual bool IsSimActive(int32_t slotId) = 0;
|
||||
|
||||
virtual bool GetNetworkSearchResult(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
|
||||
virtual bool GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback) = 0;
|
||||
virtual std::u16string GetLocaleFromDefaultSim() = 0;
|
||||
virtual std::u16string GetSimGid1(int32_t slotId) = 0;
|
||||
virtual bool SetNetworkSelectionMode(int32_t slotId, int32_t selectMode,
|
||||
const sptr<NetworkInformation> &networkInformation, bool resumeSelection,
|
||||
const sptr<INetworkSearchCallback> &callback) = 0;
|
||||
virtual std::u16string GetIsoCountryCodeForNetwork(int32_t slotId) = 0;
|
||||
virtual bool GetSimAccountInfo(int32_t subId, IccAccountInfo &info) = 0;
|
||||
virtual bool SetDefaultVoiceSlotId(int32_t subId) = 0;
|
||||
virtual int32_t GetDefaultVoiceSlotId() = 0;
|
||||
virtual int32_t RefreshSimState(int32_t slotId) = 0;
|
||||
enum {
|
||||
GET_PS_RADIO_TECH = 0,
|
||||
GET_CS_RADIO_TECH,
|
||||
@ -56,16 +80,34 @@ public:
|
||||
HAS_SIM_CARD,
|
||||
GET_SIM_STATE,
|
||||
GET_ISO_COUNTRY_CODE,
|
||||
GET_ISO_COUNTRY_CODE_FOR_NETWORK,
|
||||
GET_SPN,
|
||||
GET_ICCID,
|
||||
GET_IMSI,
|
||||
IS_SIM_ACTIVE,
|
||||
UNLOCK_PIN,
|
||||
UNLOCK_PUK,
|
||||
ALTER_PIN,
|
||||
CHECK_PIN,
|
||||
SWITCH_PIN,
|
||||
GET_SIM_OPERATOR_NUMERIC,
|
||||
GET_NETWORK_SEARCH_RESULT,
|
||||
GET_NETWORK_SELECTION_MODE,
|
||||
GET_SIM_LANGUAGE,
|
||||
GET_SIM_GID1,
|
||||
SET_NETWORK_SELECTION_MODE,
|
||||
GET_CELL_LOCATION,
|
||||
GET_SIM_ACCOUNT_INFO,
|
||||
SET_DEFAULT_VOICE_SLOTID,
|
||||
GET_DEFAULT_VOICE_SLOTID,
|
||||
REFRESH_SIM_STATE
|
||||
};
|
||||
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.telephony.ICoreService");
|
||||
protected:
|
||||
const int32_t ERROR = -1;
|
||||
const int32_t MAX_SLOT = 2;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // I_BASE_PHONE_SERVICE_H
|
||||
|
36
interfaces/innerkits/proxy/network_search_callback_proxy.cpp
Normal file
36
interfaces/innerkits/proxy/network_search_callback_proxy.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#include "network_search_callback_proxy.h"
|
||||
#include "telephony_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
NetworkSearchCallBackProxy::NetworkSearchCallBackProxy(const sptr<IRemoteObject> &impl)
|
||||
: IRemoteProxy<INetworkSearchCallback>(impl)
|
||||
{}
|
||||
int32_t NetworkSearchCallBackProxy::OnNetworkSearchCallback(
|
||||
NetworkSearchCallback requestId, MessageParcel &callBackParcel)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel replyParcel;
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return TELEPHONY_ERROR;
|
||||
}
|
||||
return remote->SendRequest(requestId, callBackParcel, replyParcel, option);
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
35
interfaces/innerkits/proxy/network_search_callback_proxy.h
Normal file
35
interfaces/innerkits/proxy/network_search_callback_proxy.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_NETWORK_SEARCH_CALLBACK_PROXY_H
|
||||
#define OHOS_NETWORK_SEARCH_CALLBACK_PROXY_H
|
||||
|
||||
#include "i_network_search_callback.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class NetworkSearchCallBackProxy : public IRemoteProxy<INetworkSearchCallback> {
|
||||
public:
|
||||
explicit NetworkSearchCallBackProxy(const sptr<IRemoteObject> &impl);
|
||||
virtual ~NetworkSearchCallBackProxy() = default;
|
||||
virtual int32_t OnNetworkSearchCallback(
|
||||
NetworkSearchCallback requestId, MessageParcel &callBackParcel) override;
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<NetworkSearchCallBackProxy> delegator_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_NETWORK_SEARCH_CALLBACK_PROXY_H
|
11
interfaces/innerkits/sms_mms/proxy/i_delivery_short_message_callback.h
Executable file → Normal file
11
interfaces/innerkits/sms_mms/proxy/i_delivery_short_message_callback.h
Executable file → Normal file
@ -12,20 +12,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef I_DELIVERY_SHORT_MESSAGE_CALLBACK_H
|
||||
#define I_DELIVERY_SHORT_MESSAGE_CALLBACK_H
|
||||
|
||||
#include "iremote_broker.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace SMS {
|
||||
namespace Telephony {
|
||||
class IDeliveryShortMessageCallback : public IRemoteBroker {
|
||||
public:
|
||||
virtual ~IDeliveryShortMessageCallback() = default;
|
||||
enum DeliveryCallback { ON_SMS_DELIVERY_RESULT };
|
||||
virtual int32_t OnSmsDeliveryResult(const std::u16string pdu) = 0;
|
||||
virtual void OnSmsDeliveryResult(const std::u16string pdu) = 0;
|
||||
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ipc.IDeliveryShortMessageCallback");
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.IDeliveryShortMessageCallback");
|
||||
};
|
||||
} // namespace SMS
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif
|
11
interfaces/innerkits/sms_mms/proxy/i_send_short_message_callback.h
Executable file → Normal file
11
interfaces/innerkits/sms_mms/proxy/i_send_short_message_callback.h
Executable file → Normal file
@ -12,11 +12,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef I_SEND_SHORT_MESSAGE_CALLBACK_H
|
||||
#define I_SEND_SHORT_MESSAGE_CALLBACK_H
|
||||
|
||||
#include "iremote_broker.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace SMS {
|
||||
namespace Telephony {
|
||||
class ISendShortMessageCallback : public IRemoteBroker {
|
||||
public:
|
||||
virtual ~ISendShortMessageCallback() = default;
|
||||
@ -42,11 +45,11 @@ public:
|
||||
|
||||
enum SendCallback { ON_SMS_SEND_RESULT };
|
||||
|
||||
virtual int32_t OnSmsSendResult(const SmsSendResult result) = 0;
|
||||
virtual void OnSmsSendResult(const SmsSendResult result) = 0;
|
||||
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ipc.ISendShortMessageCallback");
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.ISendShortMessageCallback");
|
||||
};
|
||||
} // namespace SMS
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif
|
44
interfaces/innerkits/sms_mms/proxy/i_sms_service_interface.h
Executable file → Normal file
44
interfaces/innerkits/sms_mms/proxy/i_sms_service_interface.h
Executable file → Normal file
@ -12,21 +12,45 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SMS_SERVICE_INTERFACE_H
|
||||
#define SMS_SERVICE_INTERFACE_H
|
||||
|
||||
#include "i_delivery_short_message_callback.h"
|
||||
#include "i_send_short_message_callback.h"
|
||||
#include "iremote_broker.h"
|
||||
#include "short_message.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace SMS {
|
||||
namespace Telephony {
|
||||
class ISmsServiceInterface : public IRemoteBroker {
|
||||
public:
|
||||
enum MessageID {
|
||||
TEXT_BASED_SMS_DELIVERY = 0,
|
||||
SEND_SMS_TEXT_WITEOUT_SAVE,
|
||||
SEND_SMS_TEXT_WITHOUT_SAVE,
|
||||
DATA_BASED_SMS_DELIVERY,
|
||||
SET_SMSC_ADDRESS,
|
||||
GET_SMSC_ADDRESS,
|
||||
ADD_SIM_MESSAGE,
|
||||
DEL_SIM_MESSAGE,
|
||||
UPDATE_SIM_MESSAGE,
|
||||
GET_ALL_SIM_MESSAGE,
|
||||
SET_CB_RANGE_CONFIG,
|
||||
SET_CB_CONFIG,
|
||||
SET_DEFAULT_SMS_SLOT_ID,
|
||||
GET_DEFAULT_SMS_SLOT_ID,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief SimMessageStatus
|
||||
* from 3GPP TS 27.005 V4.1.0 (2001-09) section 3 Parameter Definitions
|
||||
*/
|
||||
using SimMessageStatus = enum {
|
||||
SIM_MESSAGE_STATUS_READ = 0, // 0 REC UNREAD received unread message
|
||||
SIM_MESSAGE_STATUS_UNREAD = 1, // 1 REC READ received read message
|
||||
SIM_MESSAGE_STATUS_SENT = 2, // 2 "STO UNSENT" stored unsent message (only applicable to SMs)
|
||||
SIM_MESSAGE_STATUS_UNSENT = 3, // 3 "STO SENT" stored sent message (only applicable to SMs)
|
||||
};
|
||||
virtual ~ISmsServiceInterface() = default;
|
||||
virtual void SendMessage(int32_t slotId, const std::u16string desAddr, const std::u16string scAddr,
|
||||
const std::u16string text, const sptr<ISendShortMessageCallback> &sendCallback,
|
||||
@ -35,10 +59,22 @@ public:
|
||||
virtual void SendMessage(int32_t slotId, const std::u16string desAddr, const std::u16string scAddr,
|
||||
uint16_t port, const uint8_t *data, uint16_t dataLen, const sptr<ISendShortMessageCallback> &sendCallback,
|
||||
const sptr<IDeliveryShortMessageCallback> &deliverCallback) = 0;
|
||||
virtual bool SetSmscAddr(int32_t slotId, const std::u16string &scAddr) = 0;
|
||||
virtual std::u16string GetSmscAddr(int32_t slotId) = 0;
|
||||
virtual bool AddSimMessage(
|
||||
int32_t slotId, const std::u16string &smsc, const std::u16string &pdu, SimMessageStatus status) = 0;
|
||||
virtual bool DelSimMessage(int32_t slotId, uint32_t msgIndex) = 0;
|
||||
virtual bool UpdateSimMessage(int32_t slotId, uint32_t msgIndex, SimMessageStatus newStatus,
|
||||
const std::u16string &pdu, const std::u16string &smsc) = 0;
|
||||
virtual std::vector<ShortMessage> GetAllSimMessages(int32_t slotId) = 0;
|
||||
virtual bool SetCBConfig(
|
||||
int32_t slotId, bool enable, uint32_t fromMsgId, uint32_t toMsgId, uint8_t netType) = 0;
|
||||
virtual bool SetDefaultSmsSlotId(int32_t slotId) = 0;
|
||||
virtual int32_t GetDefaultSmsSlotId() = 0;
|
||||
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ipc.ISmsServiceInterface");
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.ISmsServiceInterface");
|
||||
};
|
||||
} // namespace SMS
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif
|
||||
|
@ -12,23 +12,28 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "sms_delivery_short_message_proxy.h"
|
||||
#include "message_option.h"
|
||||
#include "message_parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace SMS {
|
||||
namespace Telephony {
|
||||
SmsDeliveryShortMessageProxy::SmsDeliveryShortMessageProxy(const sptr<IRemoteObject> &impl)
|
||||
: IRemoteProxy<SMS::IDeliveryShortMessageCallback>(impl)
|
||||
: IRemoteProxy<IDeliveryShortMessageCallback>(impl)
|
||||
{}
|
||||
|
||||
int32_t SmsDeliveryShortMessageProxy::OnSmsDeliveryResult(const std::u16string pdu)
|
||||
void SmsDeliveryShortMessageProxy::OnSmsDeliveryResult(const std::u16string pdu)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
dataParcel.WriteString16(pdu);
|
||||
Remote()->SendRequest(ON_SMS_DELIVERY_RESULT, dataParcel, replyParcel, option);
|
||||
return 0;
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return;
|
||||
}
|
||||
remote->SendRequest(ON_SMS_DELIVERY_RESULT, dataParcel, replyParcel, option);
|
||||
}
|
||||
} // namespace SMS
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -12,23 +12,30 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SMS_DELIVERY_SHORT_MESSAGE_PROXY_H
|
||||
#define SMS_DELIVERY_SHORT_MESSAGE_PROXY_H
|
||||
|
||||
#include "i_delivery_short_message_callback.h"
|
||||
#include "iremote_object.h"
|
||||
#include "iremote_proxy.h"
|
||||
|
||||
#ifndef EFAIL
|
||||
#define EFAIL (-1)
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace SMS {
|
||||
class SmsDeliveryShortMessageProxy : public IRemoteProxy<SMS::IDeliveryShortMessageCallback> {
|
||||
namespace Telephony {
|
||||
class SmsDeliveryShortMessageProxy : public IRemoteProxy<IDeliveryShortMessageCallback> {
|
||||
public:
|
||||
explicit SmsDeliveryShortMessageProxy(const sptr<IRemoteObject> &impl);
|
||||
virtual ~SmsDeliveryShortMessageProxy() = default;
|
||||
virtual int32_t OnSmsDeliveryResult(const std::u16string pdu) override;
|
||||
virtual void OnSmsDeliveryResult(const std::u16string pdu) override;
|
||||
|
||||
protected:
|
||||
private:
|
||||
static inline BrokerDelegator<SmsDeliveryShortMessageProxy> delegator_;
|
||||
};
|
||||
} // namespace SMS
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif
|
@ -12,23 +12,28 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "sms_send_message_proxy.h"
|
||||
#include "message_option.h"
|
||||
#include "message_parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace SMS {
|
||||
namespace Telephony {
|
||||
SmsSendMessageProxy::SmsSendMessageProxy(const sptr<IRemoteObject> &impl)
|
||||
: IRemoteProxy<SMS::ISendShortMessageCallback>(impl)
|
||||
: IRemoteProxy<ISendShortMessageCallback>(impl)
|
||||
{}
|
||||
|
||||
int32_t SmsSendMessageProxy::OnSmsSendResult(const SmsSendResult result)
|
||||
void SmsSendMessageProxy::OnSmsSendResult(const SmsSendResult result)
|
||||
{
|
||||
MessageOption option;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
dataParcel.WriteInt32(result);
|
||||
Remote()->SendRequest(ON_SMS_SEND_RESULT, dataParcel, replyParcel, option);
|
||||
return 0;
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return;
|
||||
}
|
||||
remote->SendRequest(ON_SMS_SEND_RESULT, dataParcel, replyParcel, option);
|
||||
}
|
||||
} // namespace SMS
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -12,23 +12,30 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SMS_SEND_MESSAGE_PROXY_H
|
||||
#define SMS_SEND_MESSAGE_PROXY_H
|
||||
|
||||
#include "i_send_short_message_callback.h"
|
||||
#include "iremote_object.h"
|
||||
#include "iremote_proxy.h"
|
||||
|
||||
#ifndef EFAIL
|
||||
#define EFAIL (-1)
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace SMS {
|
||||
class SmsSendMessageProxy : public IRemoteProxy<SMS::ISendShortMessageCallback> {
|
||||
namespace Telephony {
|
||||
class SmsSendMessageProxy : public IRemoteProxy<ISendShortMessageCallback> {
|
||||
public:
|
||||
explicit SmsSendMessageProxy(const sptr<IRemoteObject> &impl);
|
||||
virtual ~SmsSendMessageProxy() = default;
|
||||
int32_t OnSmsSendResult(const SmsSendResult result) override;
|
||||
void OnSmsSendResult(const SmsSendResult result) override;
|
||||
|
||||
protected:
|
||||
private:
|
||||
static inline BrokerDelegator<SmsSendMessageProxy> delegator_;
|
||||
};
|
||||
} // namespace SMS
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // SEND_SHORT_MESSAGE_CALLBACK_PROXY_H
|
@ -12,10 +12,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "sms_service_proxy.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace SMS {
|
||||
namespace Telephony {
|
||||
SmsServiceProxy::SmsServiceProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<ISmsServiceInterface>(impl) {}
|
||||
|
||||
void SmsServiceProxy::SendMessage(int32_t slotId, const std::u16string desAddr, const std::u16string scAddr,
|
||||
@ -24,11 +29,9 @@ void SmsServiceProxy::SendMessage(int32_t slotId, const std::u16string desAddr,
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
printf("SmsServiceProxy::RegisterCallBack SmsServiceProxy call start 1.\n");
|
||||
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
printf("SmsServiceProxy::RegisterCallBack write descriptor fail.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
dataParcel.WriteInt32(slotId);
|
||||
@ -36,17 +39,17 @@ void SmsServiceProxy::SendMessage(int32_t slotId, const std::u16string desAddr,
|
||||
dataParcel.WriteString16(scAddr);
|
||||
dataParcel.WriteString16(text);
|
||||
if (sendCallback != nullptr) {
|
||||
if (!dataParcel.WriteRemoteObject(sendCallback->AsObject().GetRefPtr())) {
|
||||
printf("write sendcallback fail\r\n");
|
||||
}
|
||||
dataParcel.WriteRemoteObject(sendCallback->AsObject().GetRefPtr());
|
||||
}
|
||||
if (deliverCallback != nullptr) {
|
||||
if (!dataParcel.WriteRemoteObject(deliverCallback->AsObject().GetRefPtr())) {
|
||||
printf("write delivercalllback fail\r\n");
|
||||
}
|
||||
dataParcel.WriteRemoteObject(deliverCallback->AsObject().GetRefPtr());
|
||||
}
|
||||
printf("call sms service proxy\r\n");
|
||||
Remote()->SendRequest(TEXT_BASED_SMS_DELIVERY, dataParcel, replyParcel, option);
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return;
|
||||
}
|
||||
remote->SendRequest(TEXT_BASED_SMS_DELIVERY, dataParcel, replyParcel, option);
|
||||
};
|
||||
|
||||
void SmsServiceProxy::SendMessage(int32_t slotId, const std::u16string desAddr, const std::u16string scAddr,
|
||||
@ -55,10 +58,9 @@ void SmsServiceProxy::SendMessage(int32_t slotId, const std::u16string desAddr,
|
||||
{
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option;
|
||||
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
printf("SmsServiceProxy::RegisterCallBack write descriptor fail.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
dataParcel.WriteInt32(slotId);
|
||||
@ -66,20 +68,203 @@ void SmsServiceProxy::SendMessage(int32_t slotId, const std::u16string desAddr,
|
||||
dataParcel.WriteString16(scAddr);
|
||||
dataParcel.WriteInt16(port);
|
||||
if (sendCallback != nullptr) {
|
||||
if (!dataParcel.WriteRemoteObject(sendCallback->AsObject().GetRefPtr())) {
|
||||
printf("write sendcallback fail\r\n");
|
||||
}
|
||||
dataParcel.WriteRemoteObject(sendCallback->AsObject().GetRefPtr());
|
||||
}
|
||||
if (deliverCallback != nullptr) {
|
||||
if (!dataParcel.WriteRemoteObject(deliverCallback->AsObject().GetRefPtr())) {
|
||||
printf("write delivercalllback fail\r\n");
|
||||
}
|
||||
dataParcel.WriteRemoteObject(deliverCallback->AsObject().GetRefPtr());
|
||||
}
|
||||
dataParcel.WriteInt16(dataLen);
|
||||
dataParcel.WriteRawData(data, dataLen);
|
||||
Remote()->SendRequest(DATA_BASED_SMS_DELIVERY, dataParcel, replyParcel, option);
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return;
|
||||
}
|
||||
remote->SendRequest(DATA_BASED_SMS_DELIVERY, dataParcel, replyParcel, option);
|
||||
};
|
||||
|
||||
bool SmsServiceProxy::SetSmscAddr(int32_t slotId, const std::u16string &scAddr)
|
||||
{
|
||||
bool result = false;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
return result;
|
||||
}
|
||||
dataParcel.WriteInt32(slotId);
|
||||
dataParcel.WriteString16(scAddr);
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return result;
|
||||
}
|
||||
remote->SendRequest(SET_SMSC_ADDRESS, dataParcel, replyParcel, option);
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
std::u16string SmsServiceProxy::GetSmscAddr(int32_t slotId)
|
||||
{
|
||||
std::u16string result;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
return result;
|
||||
}
|
||||
dataParcel.WriteInt32(slotId);
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return result;
|
||||
}
|
||||
remote->SendRequest(GET_SMSC_ADDRESS, dataParcel, replyParcel, option);
|
||||
return replyParcel.ReadString16();
|
||||
}
|
||||
|
||||
bool SmsServiceProxy::AddSimMessage(
|
||||
int32_t slotId, const std::u16string &smsc, const std::u16string &pdu, SimMessageStatus status)
|
||||
{
|
||||
bool result = false;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
return result;
|
||||
}
|
||||
dataParcel.WriteInt32(slotId);
|
||||
dataParcel.WriteString16(smsc);
|
||||
dataParcel.WriteString16(pdu);
|
||||
dataParcel.WriteUint32(status);
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return result;
|
||||
}
|
||||
remote->SendRequest(ADD_SIM_MESSAGE, dataParcel, replyParcel, option);
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
bool SmsServiceProxy::DelSimMessage(int32_t slotId, uint32_t msgIndex)
|
||||
{
|
||||
bool result = false;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
return result;
|
||||
}
|
||||
dataParcel.WriteInt32(slotId);
|
||||
dataParcel.WriteUint32(msgIndex);
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return result;
|
||||
}
|
||||
remote->SendRequest(DEL_SIM_MESSAGE, dataParcel, replyParcel, option);
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
bool SmsServiceProxy::UpdateSimMessage(int32_t slotId, uint32_t msgIndex, SimMessageStatus newStatus,
|
||||
const std::u16string &pdu, const std::u16string &smsc)
|
||||
{
|
||||
bool result = false;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
return result;
|
||||
}
|
||||
dataParcel.WriteInt32(slotId);
|
||||
dataParcel.WriteUint32(msgIndex);
|
||||
dataParcel.WriteUint32(newStatus);
|
||||
dataParcel.WriteString16(pdu);
|
||||
dataParcel.WriteString16(smsc);
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return result;
|
||||
}
|
||||
remote->SendRequest(UPDATE_SIM_MESSAGE, dataParcel, replyParcel, option);
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
std::vector<ShortMessage> SmsServiceProxy::GetAllSimMessages(int32_t slotId)
|
||||
{
|
||||
std::vector<ShortMessage> result;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
return result;
|
||||
}
|
||||
dataParcel.WriteInt32(slotId);
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return result;
|
||||
}
|
||||
remote->SendRequest(GET_ALL_SIM_MESSAGE, dataParcel, replyParcel, option);
|
||||
|
||||
int32_t resultLen = replyParcel.ReadInt32();
|
||||
for (int32_t i = 0; i < resultLen; i++) {
|
||||
result.emplace_back(ShortMessage::UnMarshalling(replyParcel));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool SmsServiceProxy::SetCBConfig(
|
||||
int32_t slotId, bool enable, uint32_t fromMsgId, uint32_t toMsgId, uint8_t netType)
|
||||
{
|
||||
bool result = false;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
return result;
|
||||
}
|
||||
dataParcel.WriteInt32(slotId);
|
||||
dataParcel.WriteBool(enable);
|
||||
dataParcel.WriteUint32(fromMsgId);
|
||||
dataParcel.WriteUint32(toMsgId);
|
||||
dataParcel.WriteUint8(netType);
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return result;
|
||||
}
|
||||
remote->SendRequest(SET_CB_CONFIG, dataParcel, replyParcel, option);
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
bool SmsServiceProxy::SetDefaultSmsSlotId(int32_t slotId)
|
||||
{
|
||||
bool result = false;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
return result;
|
||||
}
|
||||
dataParcel.WriteInt32(slotId);
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return result;
|
||||
}
|
||||
remote->SendRequest(SET_DEFAULT_SMS_SLOT_ID, dataParcel, replyParcel, option);
|
||||
return replyParcel.ReadBool();
|
||||
}
|
||||
|
||||
int32_t SmsServiceProxy::GetDefaultSmsSlotId()
|
||||
{
|
||||
int32_t result = -1;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel replyParcel;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!dataParcel.WriteInterfaceToken(SmsServiceProxy::GetDescriptor())) {
|
||||
return result;
|
||||
}
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return result;
|
||||
}
|
||||
remote->SendRequest(GET_DEFAULT_SMS_SLOT_ID, dataParcel, replyParcel, option);
|
||||
return replyParcel.ReadInt32();
|
||||
}
|
||||
|
||||
bool SmsServiceDeathRecipient::gotDeathRecipient_ = false;
|
||||
|
||||
bool SmsServiceDeathRecipient::GotDeathRecipient()
|
||||
@ -95,5 +280,5 @@ void SmsServiceDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
|
||||
SmsServiceDeathRecipient::SmsServiceDeathRecipient() {}
|
||||
|
||||
SmsServiceDeathRecipient::~SmsServiceDeathRecipient() {}
|
||||
} // namespace SMS
|
||||
} // namespace OHOS
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
@ -12,13 +12,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SMS_SERVICE_PROXY_H
|
||||
#define SMS_SERVICE_PROXY_H
|
||||
|
||||
#include "i_sms_service_interface.h"
|
||||
|
||||
#include "iremote_object.h"
|
||||
#include "iremote_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace SMS {
|
||||
namespace Telephony {
|
||||
class SmsServiceProxy : public IRemoteProxy<ISmsServiceInterface> {
|
||||
public:
|
||||
explicit SmsServiceProxy(const sptr<IRemoteObject> &impl);
|
||||
@ -29,6 +33,17 @@ public:
|
||||
void SendMessage(int32_t slotId, const std::u16string desAddr, const std::u16string scAddr, uint16_t port,
|
||||
const uint8_t *data, uint16_t dataLen, const sptr<ISendShortMessageCallback> &sendCallback,
|
||||
const sptr<IDeliveryShortMessageCallback> &deliverCallback) override;
|
||||
bool SetSmscAddr(int32_t slotId, const std::u16string &scAddr) override;
|
||||
std::u16string GetSmscAddr(int32_t slotId) override;
|
||||
bool AddSimMessage(
|
||||
int32_t slotId, const std::u16string &smsc, const std::u16string &pdu, SimMessageStatus status) override;
|
||||
bool DelSimMessage(int32_t slotId, uint32_t msgIndex) override;
|
||||
bool UpdateSimMessage(int32_t slotId, uint32_t msgIndex, SimMessageStatus newStatus, const std::u16string &pdu,
|
||||
const std::u16string &smsc) override;
|
||||
std::vector<ShortMessage> GetAllSimMessages(int32_t slotId) override;
|
||||
bool SetCBConfig(int32_t slotId, bool enable, uint32_t fromMsgId, uint32_t toMsgId, uint8_t netType) override;
|
||||
bool SetDefaultSmsSlotId(int32_t slotId) override;
|
||||
int32_t GetDefaultSmsSlotId() override;
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<SmsServiceProxy> delegator_;
|
||||
@ -42,6 +57,6 @@ public:
|
||||
static bool GotDeathRecipient();
|
||||
static bool gotDeathRecipient_;
|
||||
};
|
||||
} // namespace SMS
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // SMS_SERVICE_PROXY_H
|
||||
#endif // SMS_SERVICE_PROXY_H
|
||||
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
|
||||
#ifndef STATE_REGISTRY_ERRORS_H
|
||||
#define STATE_REGISTRY_ERRORS_H
|
||||
|
||||
#include "../../../core_service/interfaces/innerkits/common/telephony_errors.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
enum {
|
||||
TELEPHONY_STATE_REGISTRY_DATA_NOT_EXIST = STATE_REGISTRY_ERR_OFFSET,
|
||||
TELEPHONY_STATE_UNREGISTRY_DATA_NOT_EXIST,
|
||||
TELEPHONY_STATE_REGISTRY_DATA_EXIST
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // STATE_REGISTRY_ERRORS_H
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user