From 5a0d764302d2c614c0212e2ba63c08daae80982d Mon Sep 17 00:00:00 2001 From: "manish.r" Date: Tue, 6 Sep 2016 13:59:14 +0530 Subject: [PATCH] Base Code Change-Id: I385c70fd96963dc47c49cdf6101bbdc407493982 Signed-off-by: manish.r --- .gitignore | 15 + LICENSE | 202 +++++ Tizen.Telephony/Interop/Interop.Call.cs | 79 ++ Tizen.Telephony/Interop/Interop.Libraries.cs | 21 + Tizen.Telephony/Interop/Interop.Modem.cs | 31 + Tizen.Telephony/Interop/Interop.Network.cs | 82 ++ Tizen.Telephony/Interop/Interop.Sim.cs | 58 ++ Tizen.Telephony/Interop/Interop.Telephony.cs | 69 ++ Tizen.Telephony/Properties/AssemblyInfo.cs | 36 + Tizen.Telephony/Tizen.Telephony.Net45.csproj | 72 ++ Tizen.Telephony/Tizen.Telephony.Net45.project.json | 11 + Tizen.Telephony/Tizen.Telephony.csproj | 91 +++ Tizen.Telephony/Tizen.Telephony.nuspec | 12 + Tizen.Telephony/Tizen.Telephony.project.json | 12 + Tizen.Telephony/Tizen.Telephony.snk | Bin 0 -> 596 bytes Tizen.Telephony/Tizen.Telephony/Call.cs | 98 +++ Tizen.Telephony/Tizen.Telephony/CallHandle.cs | 243 ++++++ .../Tizen.Telephony/ChangeNotificationEventArgs.cs | 272 +++++++ .../Tizen.Telephony/ExceptionFactory.cs | 68 ++ Tizen.Telephony/Tizen.Telephony/Modem.cs | 138 ++++ Tizen.Telephony/Tizen.Telephony/Network.cs | 832 +++++++++++++++++++++ Tizen.Telephony/Tizen.Telephony/Sim.cs | 458 ++++++++++++ Tizen.Telephony/Tizen.Telephony/SlotHandle.cs | 292 ++++++++ Tizen.Telephony/Tizen.Telephony/StateEventArgs.cs | 27 + Tizen.Telephony/Tizen.Telephony/Telephony.cs | 226 ++++++ packaging/csapi-telephony.manifest | 5 + packaging/csapi-telephony.spec | 111 +++ 27 files changed, 3561 insertions(+) create mode 100755 .gitignore create mode 100755 LICENSE create mode 100755 Tizen.Telephony/Interop/Interop.Call.cs create mode 100755 Tizen.Telephony/Interop/Interop.Libraries.cs create mode 100755 Tizen.Telephony/Interop/Interop.Modem.cs create mode 100755 Tizen.Telephony/Interop/Interop.Network.cs create mode 100755 Tizen.Telephony/Interop/Interop.Sim.cs create mode 100755 Tizen.Telephony/Interop/Interop.Telephony.cs create mode 100755 Tizen.Telephony/Properties/AssemblyInfo.cs create mode 100755 Tizen.Telephony/Tizen.Telephony.Net45.csproj create mode 100755 Tizen.Telephony/Tizen.Telephony.Net45.project.json create mode 100755 Tizen.Telephony/Tizen.Telephony.csproj create mode 100755 Tizen.Telephony/Tizen.Telephony.nuspec create mode 100755 Tizen.Telephony/Tizen.Telephony.project.json create mode 100755 Tizen.Telephony/Tizen.Telephony.snk create mode 100755 Tizen.Telephony/Tizen.Telephony/Call.cs create mode 100755 Tizen.Telephony/Tizen.Telephony/CallHandle.cs create mode 100755 Tizen.Telephony/Tizen.Telephony/ChangeNotificationEventArgs.cs create mode 100755 Tizen.Telephony/Tizen.Telephony/ExceptionFactory.cs create mode 100755 Tizen.Telephony/Tizen.Telephony/Modem.cs create mode 100755 Tizen.Telephony/Tizen.Telephony/Network.cs create mode 100755 Tizen.Telephony/Tizen.Telephony/Sim.cs create mode 100755 Tizen.Telephony/Tizen.Telephony/SlotHandle.cs create mode 100755 Tizen.Telephony/Tizen.Telephony/StateEventArgs.cs create mode 100755 Tizen.Telephony/Tizen.Telephony/Telephony.cs create mode 100644 packaging/csapi-telephony.manifest create mode 100755 packaging/csapi-telephony.spec diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..3744dd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +bin/ +obj/ +.svace-dir +CSCC.txt +warnings.txt +.gitattributes +*~ +*.sln +*.exe +*.dll +*.csproj.user +*.lock.json +Settings.StyleCop +StyleCop.Cache +.vs/ diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/Tizen.Telephony/Interop/Interop.Call.cs b/Tizen.Telephony/Interop/Interop.Call.cs new file mode 100755 index 0000000..84e21c2 --- /dev/null +++ b/Tizen.Telephony/Interop/Interop.Call.cs @@ -0,0 +1,79 @@ +// Copyright 2016 by Samsung Electronics, Inc. +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; +using Tizen.Telephony; +using static Tizen.Telephony.CallHandle; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Call Interop Class + /// + internal static partial class Call + { + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_preferred_voice_subscription")] + internal static extern Telephony.TelephonyError GetPreferredVoiceSubscription(IntPtr handle, out CallPreferredVoiceSubsubscription callSub); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_call_list")] + internal static extern Telephony.TelephonyError GetCallList(IntPtr handle, out uint count, out IntPtr callList); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_release_call_list")] + internal static extern Telephony.TelephonyError ReleaseCallList(uint count, IntPtr callList); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_handle_id")] + internal static extern Telephony.TelephonyError GetHandleId(IntPtr callHandle, out uint handleId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_number")] + internal static extern Telephony.TelephonyError GetNumber(IntPtr callHandle, out string number); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_type")] + internal static extern Telephony.TelephonyError GetType(IntPtr callHandle, out CallType type); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_status")] + internal static extern Telephony.TelephonyError GetStatus(IntPtr callHandle, out CallStatus status); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_direction")] + internal static extern Telephony.TelephonyError GetDirection(IntPtr callHandle, out CallDirection direction); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_conference_status")] + internal static extern Telephony.TelephonyError GetConferenceStatus(IntPtr callHandle, out bool conferenceStatus); + + internal sealed class SafeCallList : SafeHandle + { + public SafeCallList() + : base(IntPtr.Zero, true) + { + } + + public SafeCallList(IntPtr handle, uint count) + : base(handle, true) + { + Count = count; + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + ReleaseCallList(Count, this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + + internal uint Count; + } + } +} diff --git a/Tizen.Telephony/Interop/Interop.Libraries.cs b/Tizen.Telephony/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..1acc7f9 --- /dev/null +++ b/Tizen.Telephony/Interop/Interop.Libraries.cs @@ -0,0 +1,21 @@ +/// Copyright 2016 by Samsung Electronics, Inc. +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Libraries Interop Class + /// + internal static partial class Libraries + { + public const string Telephony = "libcapi-telephony.so.0"; + } +} \ No newline at end of file diff --git a/Tizen.Telephony/Interop/Interop.Modem.cs b/Tizen.Telephony/Interop/Interop.Modem.cs new file mode 100755 index 0000000..53f487c --- /dev/null +++ b/Tizen.Telephony/Interop/Interop.Modem.cs @@ -0,0 +1,31 @@ +// Copyright 2016 by Samsung Electronics, Inc. +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Modem Interop Class + /// + internal static partial class Modem + { + [DllImport(Libraries.Telephony, EntryPoint = "telephony_modem_get_imei")] + internal static extern Telephony.TelephonyError GetImei(IntPtr handle, out string imei); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_modem_get_power_status")] + internal static extern Telephony.TelephonyError GetPowerStatus(IntPtr handle, out Tizen.Telephony.Modem.PowerStatus status); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_modem_get_meid")] + internal static extern Telephony.TelephonyError GetMeid(IntPtr handle, out string meid); + } +} diff --git a/Tizen.Telephony/Interop/Interop.Network.cs b/Tizen.Telephony/Interop/Interop.Network.cs new file mode 100755 index 0000000..3b21f7e --- /dev/null +++ b/Tizen.Telephony/Interop/Interop.Network.cs @@ -0,0 +1,82 @@ +// Copyright 2016 by Samsung Electronics, Inc. +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Network Interop Class + /// + internal static partial class Network + { + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_lac")] + internal static extern Telephony.TelephonyError GetLac(IntPtr handle, out int lac); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_cell_id")] + internal static extern Telephony.TelephonyError GetCellId(IntPtr handle, out int cellId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_rssi")] + internal static extern Telephony.TelephonyError GetRssi(IntPtr handle, out Tizen.Telephony.Network.Rssi rssi); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_roaming_status")] + internal static extern Telephony.TelephonyError GetRoamingStatus(IntPtr handle, out bool status); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_mcc")] + internal static extern Telephony.TelephonyError GetMcc(IntPtr handle, out string mcc); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_mnc")] + internal static extern Telephony.TelephonyError GetMnc(IntPtr handle, out string mnc); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_network_name")] + internal static extern Telephony.TelephonyError GetNetworkName(IntPtr handle, out string networkName); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_type")] + internal static extern Telephony.TelephonyError GetType(IntPtr handle, out Tizen.Telephony.Network.Type networkType); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_ps_type")] + internal static extern Telephony.TelephonyError GetPsType(IntPtr handle, out Tizen.Telephony.Network.PsType psType); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_network_name_option")] + internal static extern Telephony.TelephonyError GetNetworkNameOption(IntPtr handle, out Tizen.Telephony.Network.NameOption networkNameOption); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_service_state")] + internal static extern Telephony.TelephonyError GetServiceState(IntPtr handle, out Tizen.Telephony.Network.ServiceState networkServiceState); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_default_data_subscription")] + internal static extern Telephony.TelephonyError GetDefaultDataSubscription(IntPtr handle, out Tizen.Telephony.Network.DefaultDataSubscription defaultSub); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_default_subscription")] + internal static extern Telephony.TelephonyError GetDefaultSubscription(IntPtr handle, out Tizen.Telephony.Network.DefaultSubscription defaultSub); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_selection_mode")] + internal static extern Telephony.TelephonyError GetSelectionMode(IntPtr handle, out Tizen.Telephony.Network.SelectionMode mode); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_tac")] + internal static extern Telephony.TelephonyError GetTac(IntPtr handle, out int tac); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_system_id")] + internal static extern Telephony.TelephonyError GetSystemId(IntPtr handle, out int sid); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_network_id")] + internal static extern Telephony.TelephonyError GetNetworkId(IntPtr handle, out int nid); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_base_station_id")] + internal static extern Telephony.TelephonyError GetBaseStationId(IntPtr handle, out int bsId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_base_station_latitude")] + internal static extern Telephony.TelephonyError GetBaseStationLatitude(IntPtr handle, out int bsLatitude); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_base_station_longitude")] + internal static extern Telephony.TelephonyError GetBaseStationLongitude(IntPtr handle, out int bsLongitude); + } +} diff --git a/Tizen.Telephony/Interop/Interop.Sim.cs b/Tizen.Telephony/Interop/Interop.Sim.cs new file mode 100755 index 0000000..a096112 --- /dev/null +++ b/Tizen.Telephony/Interop/Interop.Sim.cs @@ -0,0 +1,58 @@ +// Copyright 2016 by Samsung Electronics, Inc. +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Sim Interop Class + /// + internal static partial class Sim + { + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_icc_id")] + internal static extern Telephony.TelephonyError GetIccId(IntPtr handle, out string iccId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_operator")] + internal static extern Telephony.TelephonyError GetOperator(IntPtr handle, out string simOperator); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_msin")] + internal static extern Telephony.TelephonyError GetMsin(IntPtr handle, out string msin); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_spn")] + internal static extern Telephony.TelephonyError GetSpn(IntPtr handle, out string spn); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_is_changed")] + internal static extern Telephony.TelephonyError IsChanged(IntPtr handle, out int isChanged); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_state")] + internal static extern Telephony.TelephonyError GetState(IntPtr handle, out Tizen.Telephony.Sim.State simState); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_application_list")] + internal static extern Telephony.TelephonyError GetApplicationList(IntPtr handle, out uint appList); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_subscriber_number")] + internal static extern Telephony.TelephonyError GetSubscriberNumber(IntPtr handle, out string subscriberNumber); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_subscriber_id")] + internal static extern Telephony.TelephonyError GetSubscriberId(IntPtr handle, out string subscriberId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_lock_state")] + internal static extern Telephony.TelephonyError GetLockState(IntPtr handle, out Tizen.Telephony.Sim.LockState lockState); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_group_id1")] + internal static extern Telephony.TelephonyError GetGroupId1(IntPtr handle, out string gid1); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_call_forwarding_indicator_state")] + internal static extern Telephony.TelephonyError GetCallForwardingIndicatorState(IntPtr handle, out bool state); + } +} diff --git a/Tizen.Telephony/Interop/Interop.Telephony.cs b/Tizen.Telephony/Interop/Interop.Telephony.cs new file mode 100755 index 0000000..5c61c85 --- /dev/null +++ b/Tizen.Telephony/Interop/Interop.Telephony.cs @@ -0,0 +1,69 @@ +// Copyright 2016 by Samsung Electronics, Inc. +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. +using System; +using System.Runtime.InteropServices; +using Tizen.Telephony; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Telephony Interop Class + /// + internal static class Telephony + { + private const int TIZEN_ERROR_TELEPHONY = -0x02600000; + internal static string LogTag = "Tizen.Telephony"; + internal enum TelephonyError + { + None = Tizen.Internals.Errors.ErrorCode.None, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, + OperationFailed = TIZEN_ERROR_TELEPHONY | 0x0001, + SIMNotAvailable = TIZEN_ERROR_TELEPHONY | 0x1001 + }; + + [StructLayout(LayoutKind.Sequential)] + internal struct HandleList + { + internal uint Count; + internal IntPtr HandleArrayPointer; + }; + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_set_noti_cb")] + internal static extern TelephonyError TelephonySetNotiCb(IntPtr handle, Tizen.Telephony.ChangeNotificationEventArgs.Notification notiId, NotificationCallback cb, IntPtr userData); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_unset_noti_cb")] + internal static extern TelephonyError TelephonyUnsetNotiCb(IntPtr handle, Tizen.Telephony.ChangeNotificationEventArgs.Notification notiId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_init")] + internal static extern TelephonyError TelephonyInit(out HandleList list); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_deinit")] + internal static extern TelephonyError TelephonyDeinit(ref HandleList list); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_get_state")] + internal static extern TelephonyError TelephonyGetState(out State state); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_set_state_changed_cb")] + internal static extern TelephonyError TelephonySetStateChangedCb(StateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_unset_state_changed_cb")] + internal static extern TelephonyError TelephonyUnsetStateChangedCb(StateChangedCallback callback); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void NotificationCallback(IntPtr handle, ChangeNotificationEventArgs.Notification notiId, IntPtr data, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(State state, IntPtr userData); + } +} \ No newline at end of file diff --git a/Tizen.Telephony/Properties/AssemblyInfo.cs b/Tizen.Telephony/Properties/AssemblyInfo.cs new file mode 100755 index 0000000..3475942 --- /dev/null +++ b/Tizen.Telephony/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tizen.Telephony")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tizen.Telephony")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("14de7904-cb96-44a5-a43f-593718aaa46b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tizen.Telephony/Tizen.Telephony.Net45.csproj b/Tizen.Telephony/Tizen.Telephony.Net45.csproj new file mode 100755 index 0000000..c5da583 --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony.Net45.csproj @@ -0,0 +1,72 @@ + + + + Debug + AnyCPU + {E87B20AE-B752-4E64-9517-4827AC42A33A} + Library + Properties + Tizen.Telephony + Tizen.Telephony + 512 + v4.5 + + + true + full + false + bin\Debug\Net45\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\Net45\ + TRACE + prompt + 4 + false + + + true + + + Tizen.Telephony.snk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tizen.Telephony/Tizen.Telephony.Net45.project.json b/Tizen.Telephony/Tizen.Telephony.Net45.project.json new file mode 100755 index 0000000..d9af4f0 --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony.Net45.project.json @@ -0,0 +1,11 @@ +{ + "dependencies": { + "Tizen": "1.0.0" + }, + "frameworks": { + "net45": {} + }, + "runtimes": { + "win": {} + } +} diff --git a/Tizen.Telephony/Tizen.Telephony.csproj b/Tizen.Telephony/Tizen.Telephony.csproj new file mode 100755 index 0000000..5929b10 --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony.csproj @@ -0,0 +1,91 @@ + + + + Debug + AnyCPU + {14DE7904-CB96-44A5-A43F-593718AAA46B} + Library + Properties + Tizen.Telephony + Tizen.Telephony + 512 + + + .NETStandard + v1.6 + .NETStandard,Version=v1.6 + false + true + $(NoWarn);1701;1702 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + true + + + Tizen.Telephony.snk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory) + <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory) + true + + \ No newline at end of file diff --git a/Tizen.Telephony/Tizen.Telephony.nuspec b/Tizen.Telephony/Tizen.Telephony.nuspec new file mode 100755 index 0000000..3c91083 --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony.nuspec @@ -0,0 +1,12 @@ + + + + Tizen.Telephony + $version$ + Tizen Developers + Telephony API for Tizen.Net + + + + + diff --git a/Tizen.Telephony/Tizen.Telephony.project.json b/Tizen.Telephony/Tizen.Telephony.project.json new file mode 100755 index 0000000..beb9e15 --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony.project.json @@ -0,0 +1,12 @@ +{ + "dependencies": { + "NETStandard.Library": "1.6.0", + "Tizen": "1.0.0" + }, + "frameworks": { + "netstandard1.6": {} + }, + "runtimes": { + "win": {} + } +} diff --git a/Tizen.Telephony/Tizen.Telephony.snk b/Tizen.Telephony/Tizen.Telephony.snk new file mode 100755 index 0000000000000000000000000000000000000000..fc12d26f0425a492808b21d0ccef12e051b99570 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097fsI@Ef_F62h?AB1zbWnYT|I_*7LnMG9 zEkh|9ju0PeuoE3pn*woeAG=Q`Gc9&3Y8ed&p@f9lbX)2-74M}a^_9zOhBfDz%yIM3i~f+7<0Pw}-E0jN~!!@C9m7Wt62@bJfF^rvKqe4d;NTE4Z$=d2mX0i; zjD;RWn|4cig1iOmjr1~k$^cm3M!}_DY0A~EwAciLOKkX2+G=URh}bWA=F0&^qm=bC zfqWjS@Ujk6THAKRnMbXHCdGN^Y?07N18IYgo?FFrPnDK8@7eKlqDC`tp=JvTE$_Yh i + /// The Call API's allows you to get the voice and video call states. + /// It provides the List of CallHandle which can be used to get the information about call related actions. + /// + public class Call + { + /// + /// Public Constructor + /// + /// + /// SlotHandle received in the Manager.Init API + /// + public Call(SlotHandle handle) + { + _handle = handle._handle; + } + + /// + /// Gets the current value for the preferred voice call subscription. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The currently set preferred voicecall subscription value. + /// + public CallPreferredVoiceSubsubscription PreferredVoiceSubscription + { + get + { + CallPreferredVoiceSubsubscription subs = CallPreferredVoiceSubsubscription.Unknown; + TelephonyError error = Interop.Call.GetPreferredVoiceSubscription(_handle, out subs); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetPreferredVoiceSubscription Failed with error " + error); + return CallPreferredVoiceSubsubscription.Unknown; + } + + return subs; + } + } + + /// + /// Gets the list of the current call. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// List of CallHandle for existing calls. + /// + public List GetCallHandleList() + { + uint count; + _callList = new IntPtr(); + _list.Clear(); + TelephonyError error = Interop.Call.GetCallList(_handle, out count, out _callList); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetCallList Failed with error " + error); + return _list; + } + + _callHandle.Clear(); + IntPtr[] handleArray = new IntPtr[count]; + Marshal.Copy(_callList, handleArray, 0, (int)count); + foreach (IntPtr handle in handleArray) + { + CallHandle info = new CallHandle(handle); + _list.Add(info); + } + + _safeCallList = new Interop.Call.SafeCallList(_callList, count); + return _list; + } + + internal IntPtr _handle; + private List _callHandle = new List(); + private List _list = new List(); + private IntPtr _callList; + private Interop.Call.SafeCallList _safeCallList; + } +} diff --git a/Tizen.Telephony/Tizen.Telephony/CallHandle.cs b/Tizen.Telephony/Tizen.Telephony/CallHandle.cs new file mode 100755 index 0000000..fc2c2d1 --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony/CallHandle.cs @@ -0,0 +1,243 @@ +/// Copyright 2016 by Samsung Electronics, Inc. +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + +using System; +using static Interop.Telephony; + +namespace Tizen.Telephony +{ + /// + /// This Class provides API's to get the information about calls. + /// + public class CallHandle + { + /// + /// Enumeration for the call status. + /// + public enum CallStatus + { + /// + /// Idle status + /// + Idle, + /// + /// Active status + /// + Active, + /// + /// Held status + /// + Held, + /// + /// Dialing status + /// + Dialing, + /// + /// Alerting status + /// + Alerting, + /// + /// Incoming status + /// + Incoming, + /// + /// Unavailable + /// + Unavailable + }; + + /// + /// Enumeration for the call type. + /// + public enum CallType + { + /// + /// Voice call + /// + Voice, + /// + /// Video call + /// + Video, + /// + /// Emergency call + /// + E911, + /// + /// Unavailable + /// + Unavailable + }; + + /// + /// Enumeration for the call direction. + /// + public enum CallDirection + { + /// + /// MO(Mobile Originated) call + /// + Mo, + /// + /// MT(Mobile Terminated) call + /// + Mt, + /// + /// Unavailable + /// + Unavailable + }; + + /// + /// Gets the call handle ID. + /// + /// + /// The id of the call handle + /// 0 if unable to complete the operation + /// + public uint HandleId + { + get + { + uint handleId; + TelephonyError error = Interop.Call.GetHandleId(_callHandle, out handleId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetHandleId Failed with Error " + error); + return 0; + } + + return handleId; + } + } + + /// + /// Gets the call number. + /// + /// + /// The number of the call + /// empty string if unable to complete the operation + /// + public string Number + { + get + { + string number; + TelephonyError error = Interop.Call.GetNumber(_callHandle, out number); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetNumber Failed with Error " + error); + return ""; + } + + return number; + } + } + + /// + /// Gets the call type. + /// + /// + /// The type of the call + /// + public CallType Type + { + get + { + CallType callType; + TelephonyError error = Interop.Call.GetType(_callHandle, out callType); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetType Failed with Error " + error); + return CallType.Unavailable; + } + + return callType; + } + } + + /// + /// Gets the call status. + /// + /// + /// The status of the call + /// + public CallStatus Status + { + get + { + CallStatus callStatus; + TelephonyError error = Interop.Call.GetStatus(_callHandle, out callStatus); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetStatus Failed with Error " + error); + return CallStatus.Unavailable; + } + + return callStatus; + } + } + + /// + /// Gets whether the call is MO(Mobile Originated) call or MT(Mobile Terminated). + /// + /// + /// The direction of the call + /// + /// + /// This Exception can occur due to: + /// 1. Operation Not Supported + /// + public CallDirection Direction + { + get + { + CallDirection callDirection; + TelephonyError error = Interop.Call.GetDirection(_callHandle, out callDirection); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetDirection Failed with Error " + error); + return CallDirection.Unavailable; + } + + return callDirection; + } + + } + + /// + /// Gets whether the call is conference call or not. + /// + /// + /// The value whether the call is conference call or not. (true: Conference call, false: Single call) + /// + public bool ConferenceStatus + { + get + { + bool callConfStatus; + TelephonyError error = Interop.Call.GetConferenceStatus(_callHandle, out callConfStatus); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetConferenceStatus Failed with Error " + error); + return false; + } + + return callConfStatus; + } + + } + + internal CallHandle(IntPtr handle) + { + _callHandle = handle; + } + + private IntPtr _callHandle; + } +} diff --git a/Tizen.Telephony/Tizen.Telephony/ChangeNotificationEventArgs.cs b/Tizen.Telephony/Tizen.Telephony/ChangeNotificationEventArgs.cs new file mode 100755 index 0000000..3856f8a --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony/ChangeNotificationEventArgs.cs @@ -0,0 +1,272 @@ +/// Copyright 2016 by Samsung Electronics, Inc. +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + +using System; +namespace Tizen.Telephony +{ + /// + /// This Class contains the data related to the Notification event + /// + public class ChangeNotificationEventArgs : EventArgs + { + /// + /// Enumeration for Telephony notification. + /// + public enum Notification + { + /// + /// Notification to be invoked when the SIM card state changes. + /// SIM.State will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + SimStatus = 0x10, + /// + /// Notification to be invoked when the SIM call forwarding indicator state changes. + /// 'state(bool)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + SimCallForwardingIndicatorState, + /// + /// Notification to be invoked when the network service state changes. + /// Network.ServiceState will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + NetworkServiceState = 0x20, + /// + /// Notification to be invoked when the cell ID changes. + /// 'cell_id(int)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkCellid, + /// + /// Notification to be invoked when the roaming status changes. + /// 'roaming_status(bool)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + NetworkRoamingStatus, + /// + /// Notification to be invoked when the signal strength changes. + /// Network.Rssi will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + NetworkSignalstrengthLevel, + /// + /// Notification to be invoked when the network name changes. + /// 'network_name(string)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + NetworkNetworkName, + /// + /// Notification to be invoked when the ps type changes. + /// Network.PSType will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + NetworkPsType, + /// + /// Notification to be invoked when the default data subscription changes. + /// Network.DefaultDataSubscription will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + NetworkDefaultDataSubscription, + /// + /// Notification to be invoked when the default subscription changes. + /// Network.DefaultSubscription will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + NetworkDefaultSubscription, + /// + /// Notification to be invoked when the LAC (Location Area Code) changes. + /// 'lac(int)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkLac, + /// + /// Notification to be invoked when the TAC (Tracking Area Code) changes. + /// 'tac(int)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkTac, + /// + /// Notification to be invoked when the system ID changes. + /// 'sid(int)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkSystemId, + /// + /// Notification to be invoked when the network ID changes. + /// 'nid(int)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkId, + /// + /// Notification to be invoked when the base station ID changes. + /// 'id(int)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkBsId, + /// + /// Notification to be invoked when the base station latitude changes. + /// 'latitude(int)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkBsLatitude, + /// + /// Notification to be invoked when the base station longitude changes. + /// 'longitue(int)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkBsLongitude, + /// + /// Notification to be invoked when a voice call is in idle status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusIdle, + /// + /// Notification to be invoked when a voice call is in active status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusActive, + /// + /// Notification to be invoked when a voice call is in held status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusHeld, + /// + /// Notification to be invoked when a voice call is in dialing status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusDialing, + /// + /// Notification to be invoked when a voice call is in alertingstatus. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusAlerting, + /// + /// Notification to be invoked when a voice call is in incoming status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusIncoming, + /// + /// Notification to be invoked when a video call is in idle status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + VideoCallStatusIdle, + /// + /// Notification to be invoked when a video call is in active status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + VideoCallStatusActive, + /// + /// Notification to be invoked when a video call is in dialing status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// + /// http://tizen.org/privilege/telephony + /// + VideoCallStatusDialing, + /// + /// Notification to be invoked when a video call is in alerting status. + /// 'handle id(uint)' will be delivered in notification data + /// + /// + /// http://tizen.org/privilege/telephony + /// + VideoCallStatusAlerting, + /// + /// Notification to be invoked when a video call is in incoming status. + /// 'handle id(uint)' will be delivered in notification data + /// + /// + /// http://tizen.org/privilege/telephony + /// + VideoCallStatusIncoming, + /// + /// Notification to be invoked when the preferred voice subscription changes. + /// CallPreferredVoiceSubsubscription will be delivered in notification data + /// + /// + /// http://tizen.org/privilege/telephony + /// + CallPreferredVoiceSubscription + }; + + /// + /// Telephony notification type + /// + public Notification notificationType; + + /// + /// Data as per the Notification type + /// + public object notificationData; + + internal ChangeNotificationEventArgs(Notification noti, object data) + { + notificationType = noti; + notificationData = data; + } + } +} diff --git a/Tizen.Telephony/Tizen.Telephony/ExceptionFactory.cs b/Tizen.Telephony/Tizen.Telephony/ExceptionFactory.cs new file mode 100755 index 0000000..19de09f --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony/ExceptionFactory.cs @@ -0,0 +1,68 @@ +/// Copyright 2016 by Samsung Electronics, Inc. +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. +using System; + +namespace Tizen.Telephony +{ + internal static class ExceptionFactory + { + internal static Exception CreateException(Interop.Telephony.TelephonyError err) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "Error " + err); + Exception exp; + switch (err) + { + case Interop.Telephony.TelephonyError.InvalidParameter: + { + exp = new ArgumentException("Invalid Parameters Provided"); + break; + } + + case Interop.Telephony.TelephonyError.NotSupported: + { + exp = new InvalidOperationException("Not Supported"); + break; + } + + case Interop.Telephony.TelephonyError.OperationFailed: + { + exp = new InvalidOperationException("Operation Failed"); + break; + } + + case Interop.Telephony.TelephonyError.OutOfMemory: + { + exp = new InvalidOperationException("Out Of Memory"); + break; + } + + case Interop.Telephony.TelephonyError.PermissionDenied: + { + exp = new InvalidOperationException("Permission Denied"); + break; + } + + case Interop.Telephony.TelephonyError.SIMNotAvailable: + { + exp = new InvalidOperationException("SIM is Not Available"); + break; + } + + default: + { + exp = new Exception(""); + break; + } + + } + + return exp; + } + + } +} diff --git a/Tizen.Telephony/Tizen.Telephony/Modem.cs b/Tizen.Telephony/Tizen.Telephony/Modem.cs new file mode 100755 index 0000000..856aed8 --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony/Modem.cs @@ -0,0 +1,138 @@ +/// Copyright 2016 by Samsung Electronics, Inc. +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + +using System; +using static Interop.Telephony; +namespace Tizen.Telephony +{ + /// + /// This Class provides API's to obtain information from the modem. + /// + public class Modem + { + /// + /// Modem Class Constructor + /// + /// + /// SlotHandle received in the Manager.Init API + /// + public Modem(SlotHandle handle) + { + _handle = handle._handle; + } + + /// + /// Enumeration for Modem Power Status. + /// + public enum PowerStatus + { + /// + /// Unknown + /// + Unknown = -1, + /// + /// Modem power ON + /// + On, + /// + /// Modem power OFF + /// + Off, + /// + /// Modem power RESET + /// + Reset, + /// + /// Modem power LOW + /// + Low + }; + + /// + /// Gets the IMEI (International Mobile Station Equipment Identity) of a mobile phone. + /// The IMEI number is used by a GSM network to identify valid devices and therefore can be used for stopping a stolen phone from accessing that network. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The International Mobile Station Equipment Identity + /// empty string if unable to complete the operation + /// + public string Imei + { + get + { + string imei; + TelephonyError error = Interop.Modem.GetImei(_handle, out imei); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetImei Failed with error " + error); + return ""; + } + + return imei; + } + } + + /// + /// Gets the power status of the modem. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The Modem power status (0=on,1=off,2=reset,3=low) + /// + public PowerStatus CurrentPowerStatus + { + get + { + PowerStatus status; + TelephonyError error = Interop.Modem.GetPowerStatus(_handle, out status); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetImei Failed with error " + error); + return PowerStatus.Unknown; + } + + return status; + } + + } + + /// + /// Gets the MEID (Mobile Equipment Identifier) of a mobile phone. (for CDMA) + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The Mobile Equipment Identifier + /// empty string if unable to complete the operation + /// + public string Meid + { + get + { + string meid; + TelephonyError error = Interop.Modem.GetMeid(_handle, out meid); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetMeid Failed with error " + error); + return ""; + } + + return meid; + } + + } + + internal IntPtr _handle; + } +} diff --git a/Tizen.Telephony/Tizen.Telephony/Network.cs b/Tizen.Telephony/Tizen.Telephony/Network.cs new file mode 100755 index 0000000..45c6728 --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony/Network.cs @@ -0,0 +1,832 @@ +/// Copyright 2016 by Samsung Electronics, Inc. +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + +using System; +using static Interop.Telephony; +namespace Tizen.Telephony +{ + /// + /// The Network class provides API's to obtain information about the current telephony service network. + /// + public class Network + { + /// + /// Enumeration for RSSI (Receive Signal Strength Indicator). + /// Rssi6 indicates the highest strength. + /// + public enum Rssi + { + /// + /// Strength 0 + /// + Rssi0, + /// + /// Strength 1 + /// + Rssi1, + /// + /// Strength 2 + /// + Rssi2, + /// + /// Strength 3 + /// + Rssi3, + /// + /// Strength 4 + /// + Rssi4, + /// + /// Strength 5 + /// + Rssi5, + /// + /// Strength 6 + /// + Rssi6, + /// + /// Unavailable + /// + Unavailable + } + + /// + /// Enumeration for Network Type. + /// + public enum Type + { + /// + /// Unknown + /// + Unknown, + /// + /// 2G GSM network type + /// + Gsm, + /// + /// 2.5G GPRS network type + /// + Gprs, + /// + /// 2.5G EDGE network type + /// + Edge, + /// + /// 3G UMTS network type + /// + Umts, + /// + /// HSDPA network type + /// + Hsdpa, + /// + /// LTE network type + /// + Lte, + /// + /// IS95A network type + /// + Is95a, + /// + /// IS95B network type + /// + Is95b, + /// + /// CDMA 1x network type + /// + Cdma1X, + /// + /// EVDO revision 0 network type + /// + EvdoRev0, + /// + /// EVDO revision A network type + /// + EvdoRevA, + /// + /// EVDO revision B network type + /// + EvdoRevB, + /// + /// EVDV network type + /// + Evdv, + /// + /// EHRPD network type + /// + Ehrpd + } + + /// + /// Enumeration for PS Type. + /// + public enum PsType + { + /// + /// Unknown + /// + Unknown, + /// + /// HSDPA ps type + /// + Hsdpa, + /// + /// HSUPA ps type + /// + Hsupa, + /// + /// HSPA ps type + /// + Hspa, + /// + /// HSPAP ps type + /// + Hspap + } + + /// + /// Enumeration for Network Service State. + /// + public enum ServiceState + { + /// + /// In service + /// + InService, + /// + /// Out of service + /// + OutOfService, + /// + /// Only emergency call is allowed + /// + EmergencyOnly, + /// + /// Unavailable + /// + Unavailable + } + + /// + /// Enumeration for Network Name Priority. + /// + public enum NameOption + { + /// + /// Unknown + /// + Unknown, + /// + /// Network name displayed by SPN + /// + Spn, + /// + /// Network name displayed by Network + /// + Network, + /// + /// Network name displayed by SPN or Network + /// + Any + } + + /// + /// Enumeration for the possible 'default' Data Subscriptions for Packet Switched(PS). + /// + public enum DefaultDataSubscription + { + /// + /// Unknown status + /// + Unknown = -1, + /// + /// SIM 1 + /// + Sim1, + /// + /// SIM 2 + /// + Sim2 + } + + /// + /// Enumeration defines possible 'default' Subscriptions for Circuit Switched(CS). + /// + public enum DefaultSubscription + { + /// + /// Unknown status + /// + Unknown = -1, + /// + /// SIM 1 network + /// + Sim1, + /// + /// SIM 2 network + /// + Sim2 + } + + /// + /// Enumeration for network selection mode. + /// + public enum SelectionMode + { + /// + /// Automatic mode + /// + Automatic, + /// + /// Manual mode + /// + Manual, + /// + /// Unavailable + /// + Unavailable + } + + /// + /// Network Class Constructor + /// + /// + /// SlotHandle received in the Manager.Init API + /// + public Network(SlotHandle handle) + { + _handle = handle._handle; + } + + /// + /// Gets the LAC (Location Area Code) of the current location. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + /// + /// This API can be used in GSM / WCDMA network. + /// + /// + /// The Location Area Code, -1 if unknown + /// + public int Lac + { + get + { + int lac; + TelephonyError error = Interop.Network.GetLac(_handle, out lac); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetLac Failed with error " + error); + return -1; + } + + Log.Info(Interop.Telephony.LogTag, "Lac Value " + lac); + return lac; + } + + } + + /// + /// Gets the cell ID of the current location. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + /// + /// This API can be used in GSM / WCDMA / LTE network. + /// + /// + /// The cell identification number, -1 if unknown + /// + public int CellId + { + get + { + int cellId; + TelephonyError error = Interop.Network.GetCellId(_handle, out cellId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetCellId Failed with error " + error); + return -1; + } + + Log.Info(Interop.Telephony.LogTag, "CellId Value " + cellId); + return cellId; + } + } + + /// + /// Gets the RSSI (Received Signal Strength Indicator). + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The Received Signal Strength Indicator + /// Higher the received number, the stronger the signal strength. + /// + public Rssi CurrentRssi + { + get + { + Rssi currentRssi; + TelephonyError error = Interop.Network.GetRssi(_handle, out currentRssi); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetRssi Failed with error " + error); + return Rssi.Unavailable; + } + + Log.Info(Interop.Telephony.LogTag, "CurrentRssi Value " + currentRssi); + return currentRssi; + } + } + + /// + /// Gets the roaming state of the current registered network. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// true if roaming, otherwise false if not roaming + /// + public bool RoamingStatus + { + get + { + bool roamingStatus; + TelephonyError error = Interop.Network.GetRoamingStatus(_handle, out roamingStatus); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetRoamingStatus Failed with error " + error); + return false; + } + + return roamingStatus; + } + } + + /// + /// Gets the MCC (Mobile Country Code) of the current registered network. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// This API can be used in GSM / WCDMA / LTE network. + /// + /// + /// The Mobile Country Code (three digits) Mobile Country Code (MCC) identifies the country where the cell is being used. + /// empty string if unknown. + /// + public string Mcc + { + get + { + string mcc; + TelephonyError error = Interop.Network.GetMcc(_handle, out mcc); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetMcc Failed with error " + error); + return ""; + } + + return mcc; + } + } + + /// + /// Gets the MNC (Mobile Network Code) of the current registered network. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// This API can be used in GSM / WCDMA / LTE network. + /// + /// + /// The Mobile Network Code (three digits) The Mobile Network Code (MNC) identifies the mobile phone operator and network provider. + /// empty string if unknown. + /// + public string Mnc + { + get + { + string mnc; + TelephonyError error = Interop.Network.GetMnc(_handle, out mnc); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetMnc Failed with error " + error); + return ""; + } + + return mnc; + } + } + + /// + /// Gets the name of the current registered network. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// This API can be used in GSM / WCDMA / LTE network. + /// + /// + /// The name of the current registered network + /// empty string if unknown. + /// + public string NetworkName + { + get + { + string networkName; + TelephonyError error = Interop.Network.GetNetworkName(_handle, out networkName); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetNetworkName Failed with error " + error); + return ""; + } + + return networkName; + } + } + + /// + /// Gets the network service type of the current registered network. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// This API can be used in case network is in service. + /// + /// + /// The network service type + /// + public Type NetworkType + { + get + { + Type networkType; + TelephonyError error = Interop.Network.GetType(_handle, out networkType); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetType Failed with error " + error); + return Type.Unknown; + } + + return networkType; + } + } + + /// + /// Gets the packet service type of the current registered network. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// This API can be used in HSDPA network. + /// + /// + /// The type of packet service + /// + public PsType NetworkPsType + { + get + { + PsType networkPsType; + TelephonyError error = Interop.Network.GetPsType(_handle, out networkPsType); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetPsType Failed with error " + error); + return PsType.Unknown; + } + + return networkPsType; + } + + } + + /// + /// Gets the network name option of the current registered network. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The network name display option + /// + public NameOption NetworkNameOption + { + get + { + NameOption networkNameOption; + TelephonyError error = Interop.Network.GetNetworkNameOption(_handle, out networkNameOption); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetNetworkNameOption Failed with error " + error); + return NameOption.Unknown; + } + + return networkNameOption; + } + + } + + /// + /// Gets the current network state of the telephony service. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The current network state + /// + public ServiceState NetworkServiceState + { + get + { + ServiceState networkServiceState; + TelephonyError error = Interop.Network.GetServiceState(_handle, out networkServiceState); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetServiceState Failed with error " + error); + return ServiceState.Unavailable; + } + + return networkServiceState; + } + + } + + /// + /// Gets the current default subscription for data service (Packet Switched). + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The current default data subscription + /// + public DefaultDataSubscription NetworkDefaultDataSubscription + { + get + { + DefaultDataSubscription networkDefaultDataSubs; + TelephonyError error = Interop.Network.GetDefaultDataSubscription(_handle, out networkDefaultDataSubs); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetDefaultDataSubscription Failed with error " + error); + return DefaultDataSubscription.Unknown; + } + + return networkDefaultDataSubs; + } + + } + + /// + /// Gets the current default subscription for voice service (Circuit Switched). + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The current default voice subscription + /// + public DefaultSubscription NetworkDefaultSubscription + { + get + { + DefaultSubscription networkDefaultSubscription; + TelephonyError error = Interop.Network.GetDefaultSubscription(_handle, out networkDefaultSubscription); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetDefaultSubscription Failed with error " + error); + return DefaultSubscription.Unknown; + } + + return networkDefaultSubscription; + } + + } + + /// + /// Gets the network selection mode. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The network selection mode. + /// + public SelectionMode NetworkSelectionMode + { + get + { + SelectionMode networkSelectionMode; + TelephonyError error = Interop.Network.GetSelectionMode(_handle, out networkSelectionMode); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetSelectionMode Failed with error " + error); + return SelectionMode.Unavailable; + } + + return networkSelectionMode; + } + + } + + /// + /// Gets the TAC (Tracking Area Code) of the current location. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// This API can be used in LTE network. + /// + /// + /// The Tracking Area Code + /// -1 if unknown + /// + public int Tac + { + get + { + int tac; + TelephonyError error = Interop.Network.GetTac(_handle, out tac); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetTac Failed with error " + error); + return -1; + } + + return tac; + } + + } + + /// + /// Gets the system ID of the current location. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// This API can be used in CDMA network. + /// + /// + /// The system ID + /// -1 if unknown + /// + public int SystemId + { + get + { + int systemId; + TelephonyError error = Interop.Network.GetSystemId(_handle, out systemId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetSystemId Failed with error " + error); + return -1; + } + + return systemId; + } + + } + + /// + /// Gets the network ID of the current location. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + /// + /// This API can be used in CDMA network. + /// + /// + /// The network ID + /// -1 if unknown + /// + public int NetworkId + { + get + { + int networkId; + TelephonyError error = Interop.Network.GetNetworkId(_handle, out networkId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetNetworkId Failed with error " + error); + return -1; + } + + return networkId; + } + + } + + /// + /// Gets the base station ID of the current location. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + /// + /// This API can be used in CDMA network. + /// + /// + /// The base station ID + /// -1 if unknown + /// + + public int BaseStationId + { + get + { + int baseStationId; + TelephonyError error = Interop.Network.GetBaseStationId(_handle, out baseStationId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetBaseStationId Failed with error " + error); + return -1; + } + + return baseStationId; + } + + } + + /// + /// Gets the base station latitude of the current location. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + /// + /// This API can be used in CDMA network. + /// + /// + /// The base station latitude + /// 0x7FFFFFFF if unknown + /// + public int BaseStationLatitude + { + get + { + int baseStationLatitude; + TelephonyError error = Interop.Network.GetBaseStationLatitude(_handle, out baseStationLatitude); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetBaseStationLatitude Failed with error " + error); + return 0x7FFFFFFF; + } + + return baseStationLatitude; + } + } + + /// + /// Gets the base station longitude of the current location. + /// + /// + /// http://tizen.org/privilege/location.coarse + /// + /// + /// This API can be used in CDMA network. + /// + /// + /// The base station latitude + /// 0x7FFFFFFF if unknown + /// + public int BaseStationLongitude + { + get + { + int baseStationLongitude; + TelephonyError error = Interop.Network.GetBaseStationLongitude(_handle, out baseStationLongitude); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetBaseStationLongitude Failed with error " + error); + return 0x7FFFFFFF; + } + + return baseStationLongitude; + } + } + + internal IntPtr _handle; + } +} diff --git a/Tizen.Telephony/Tizen.Telephony/Sim.cs b/Tizen.Telephony/Tizen.Telephony/Sim.cs new file mode 100755 index 0000000..143e73f --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony/Sim.cs @@ -0,0 +1,458 @@ +/// Copyright 2016 by Samsung Electronics, Inc. +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + +using System; +using static Interop.Telephony; + +namespace Tizen.Telephony +{ + /// + /// This Class provides API's that allows you to extract information stored on a SIM card + /// + public class Sim + { + /// + /// Enumeration for the state of SIM card. + /// + public enum State + { + /// + /// SIM is not available on this device + /// + Unavailable, + /// + /// SIM is locked + /// + Locked, + /// + /// SIM is available on this device (SIM is not locked) + /// + Available, + /// + /// SIM is in transition between states + /// + Unknown + } + + /// + /// Enumeration for the lock state of SIM card. + /// + public enum LockState + { + /// + /// SIM is not in lock + /// + Unknown, + /// + /// SIM is PIN(Personal Identification Number) locked + /// + PinRequired, + /// + /// SIM is PUK(Personal Unblocking Code) locked + /// + PukRequired, + /// + /// SIM is permanently blocked(All the attempts for PIN/PUK failed) + /// + PermLocked, + /// + /// SIM is NCK(Network Control Key) locked + /// + NckRequired + } + + /// + /// Enumeration for the type of SIM card. + /// + public enum ApplicationType + { + /// + /// SIM(GSM) Application + /// + Sim = 0x01, + /// + /// USIM Application + /// + Usim = 0x02, + /// + /// CDMA Application + /// + Csim = 0x04, + /// + /// ISIM Application + /// + Isim = 0x08 + } + + /// + /// Sim Class Constructor + /// + /// + /// SlotHandle received in the Manager.Init API + /// + public Sim(SlotHandle handle) + { + _handle = handle._handle; + } + + /// + /// Gets the Integrated Circuit Card IDentification (ICC-ID). + /// The Integrated Circuit Card Identification number internationally identifies SIM cards. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The Integrated Circuit Card Identification + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string IccId + { + get + { + string iccId; + TelephonyError error = Interop.Sim.GetIccId(_handle, out iccId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetIccId Failed with error " + error); + return ""; + } + + return iccId; + } + } + + /// + /// Gets the SIM Operator (MCC [3 digits] + MNC [2~3 digits]). + /// The Operator is embedded in the SIM card. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The SIM Operator + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string Operator + { + get + { + string simOperator; + TelephonyError error = Interop.Sim.GetOperator(_handle, out simOperator); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetOperator Failed with error " + error); + return ""; + } + + return simOperator; + } + } + + /// + /// Gets the Mobile Subscription Identification Number (MSIN [9~10 digits]) of the SIM provider. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The Mobile Subscription Identification Number + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string Msin + { + get + { + string msin; + TelephonyError error = Interop.Sim.GetMsin(_handle, out msin); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetMsin Failed with error " + error); + return ""; + } + + return msin; + } + } + + /// + /// Gets the Service Provider Name (SPN) of the SIM card. + /// Gets Service Provider Name embedded in the SIM card.If this value is not stored in SIM card, empty string will be returned. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The Service Provider Name + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string Spn + { + get + { + string spn; + TelephonyError error = Interop.Sim.GetSpn(_handle, out spn); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetSpn Failed with error " + error); + return ""; + } + + return spn; + } + } + + /// + /// Checks whether the current SIM card is different from the previous SIM card. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// true if the current SIM card is different from the previous SIM card, otherwise false if the SIM card is not changed + /// + /// + /// The SIM state must be Available + /// + public bool IsChanged + { + get + { + int ischanged; + bool isChanged = false; ; + TelephonyError error = Interop.Sim.IsChanged(_handle, out ischanged); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "IsChanged Failed with error " + error); + return false; + } + + if (ischanged > 0) + { + isChanged = true; + } + + return isChanged; + } + } + + /// + /// Gets the state of the SIM. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The current state of the SIM + /// + public State CurrentState + { + get + { + State currentState; + TelephonyError error = Interop.Sim.GetState(_handle, out currentState); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetState Failed with error " + error); + return State.Unavailable; + } + + return currentState; + } + } + + /// + /// Gets the list of application on UICC. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The masking value for below values are provided by the enum ApplicationType + /// 0 if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public uint ApplicationList + { + get + { + uint appList; + TelephonyError error = Interop.Sim.GetApplicationList(_handle, out appList); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetApplicationList Failed with error " + error); + return 0; + } + + return appList; + } + } + + /// + /// Gets subscriber number embedded in the SIM card. This value contains MSISDN related to the subscriber. + /// If this value is not stored in SIM card, empty string will be returned. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The subscriber number in the SIM + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string SubscriberNumber + { + get + { + string subscriberNumber; + TelephonyError error = Interop.Sim.GetSubscriberNumber(_handle, out subscriberNumber); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetSubscriberNumber Failed with error " + error); + return ""; + } + + return subscriberNumber; + } + } + + /// + /// Gets the Subscriber ID. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The subscriber ID + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string SubscriberId + { + get + { + string subscriberId; + TelephonyError error = Interop.Sim.GetSubscriberId(_handle, out subscriberId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetSubscriberId Failed with error " + error); + return ""; + } + + return subscriberId; + } + } + + /// + /// Gets the lock state of the SIM. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The current lock state of the SIM + /// + /// + /// The SIM state must be Available + /// + public LockState CurrentLockState + { + get + { + LockState currentLockState; + TelephonyError error = Interop.Sim.GetLockState(_handle, out currentLockState); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetLockState Failed with error " + error); + return LockState.Unknown; + } + + return currentLockState; + } + } + + /// + /// Gets the GID1 (Group Identifier Level 1). + /// Gets Group Identifier Level 1(GID1) embedded in the SIM card.If this value is not stored in SIM card, empty string will be returned. + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The GID1 (Group Identifier Level 1) + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string GroupId1 + { + get + { + string groupId1; + TelephonyError error = Interop.Sim.GetGroupId1(_handle, out groupId1); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetGroupId1 Failed with error " + error); + return ""; + } + + return groupId1; + } + } + + /// + /// Gets the call forwarding indicator state of the SIM. + /// If the state is true, incoming call will be forwarded to the selected number.state indicates the CFU(Call Forwarding Unconditional) indicator status - Voice. (3GPP TS 31.102 4.2.64 EF CFIS) + /// + /// + /// http://tizen.org/privilege/telephony + /// + /// + /// The value whether incoming call will be forwarded or not. (true: forwarded, false: not forwarded) + /// + /// + /// The SIM state must be Available + /// + public bool CallForwardingIndicatorState + { + get + { + bool callForwardingIndicatorState; + TelephonyError error = Interop.Sim.GetCallForwardingIndicatorState(_handle, out callForwardingIndicatorState); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetCallForwardingIndicatorState Failed with error " + error); + return false; + } + + return callForwardingIndicatorState; + } + } + + internal IntPtr _handle; + } +} diff --git a/Tizen.Telephony/Tizen.Telephony/SlotHandle.cs b/Tizen.Telephony/Tizen.Telephony/SlotHandle.cs new file mode 100755 index 0000000..e19b4ab --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony/SlotHandle.cs @@ -0,0 +1,292 @@ +/// Copyright 2016 by Samsung Electronics, Inc. +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Telephony +{ + public class SlotHandle + { + /// + /// Event Handler for Receiving the Telephony State Changes + /// this event will be triggered for the NotificationId's given in the SetNotificationId API + /// + public event EventHandler ChangeNotification; + + /// + /// The Notification Id's for which the ChangeNotification event will be triggered + /// + /// + /// The List of Notification Id's for which the ChangeNotification event will be triggered + /// + /// + /// This Exception can occur due to: + /// 1. Operation Not Supported + /// 2. Operation Failed + /// + public void SetNotificationId(List list) + { + try + { + foreach (ChangeNotificationEventArgs.Notification n in list) + { + SetCallback(n); + } + } + catch (Exception e) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "SetNotificationId Failed with Error " + e.ToString()); + throw e; + } + } + + /// + /// The Notification Id's for which the ChangeNotification event will not be triggered + /// + /// + /// The List of Notification Id's for which the ChangeNotification event will be not be triggered + /// + /// + /// This Exception can occur due to: + /// 1. Operation Not Supported + /// 2. Operation Failed + /// + public void RemoveNotificationId(List list) + { + foreach (ChangeNotificationEventArgs.Notification n in list) + { + Interop.Telephony.TelephonyError error = Interop.Telephony.TelephonyUnsetNotiCb(_handle, n); + if (error != Interop.Telephony.TelephonyError.None) + { + throw ExceptionFactory.CreateException(error); + } + } + } + + internal SlotHandle(IntPtr handle) + { + _handle = handle; + } + + internal IntPtr Handle + { + get + { + return _handle; + } + } + + internal IntPtr _handle; + private void SetCallback(ChangeNotificationEventArgs.Notification n) + { + Interop.Telephony.NotificationCallback NotificationDelegate = (IntPtr handle, ChangeNotificationEventArgs.Notification notiId, IntPtr data, IntPtr userData) => + { + SlotHandle simHandle = Manager.FindHandle(handle); + object notiData = null; + switch (notiId) + { + case ChangeNotificationEventArgs.Notification.SimStatus: + { + notiData = (Sim.State)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.SimCallForwardingIndicatorState: + { + notiData = ((Marshal.ReadInt32(data) == 0) ? false : true); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkServiceState: + { + notiData = (Network.ServiceState)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkCellid: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkRoamingStatus: + { + notiData = (Marshal.ReadInt32(data) == 0) ? false : true; + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkSignalstrengthLevel: + { + notiData = (Network.Rssi)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkNetworkName: + { + notiData = Marshal.PtrToStringAnsi(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkPsType: + { + notiData = (Network.PsType)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkDefaultDataSubscription: + { + notiData = (Network.DefaultDataSubscription)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkDefaultSubscription: + { + notiData = (Network.DefaultSubscription)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkLac: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkTac: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkSystemId: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkId: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkBsId: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkBsLatitude: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkBsLongitude: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusIdle: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusActive: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusHeld: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusDialing: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusAlerting: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusIncoming: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VideoCallStatusIdle: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VideoCallStatusActive: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VideoCallStatusDialing: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VideoCallStatusAlerting: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VideoCallStatusIncoming: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.CallPreferredVoiceSubscription: + { + notiData = (CallPreferredVoiceSubsubscription)Marshal.ReadInt32(data); + break; + } + + } + + ChangeNotificationEventArgs args = new ChangeNotificationEventArgs(notiId, notiData); + ChangeNotification?.Invoke(simHandle, args); + }; + _changeNotificationList.Add(NotificationDelegate); + + Interop.Telephony.TelephonyError error = Interop.Telephony.TelephonySetNotiCb(_handle, n, NotificationDelegate, IntPtr.Zero); + if (error != Interop.Telephony.TelephonyError.None) + { + Exception e = ExceptionFactory.CreateException(error); + // Check if error is Invalid Parameter then hide the error + if (e is ArgumentException) + { + e = new InvalidOperationException("Internal Error Occured"); + } + + throw e; + } + } + + private List _changeNotificationList = new List(); + } +} diff --git a/Tizen.Telephony/Tizen.Telephony/StateEventArgs.cs b/Tizen.Telephony/Tizen.Telephony/StateEventArgs.cs new file mode 100755 index 0000000..3be5c31 --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony/StateEventArgs.cs @@ -0,0 +1,27 @@ +/// Copyright 2016 by Samsung Electronics, Inc. +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + +using System; +namespace Tizen.Telephony +{ + /// + /// This class contain the data related to the State changed event + /// + public class StateEventArgs : EventArgs + { + /// + /// The Current State + /// + public State currentState; + + internal StateEventArgs(State s) + { + currentState = s; + } + } +} diff --git a/Tizen.Telephony/Tizen.Telephony/Telephony.cs b/Tizen.Telephony/Tizen.Telephony/Telephony.cs new file mode 100755 index 0000000..8093ed4 --- /dev/null +++ b/Tizen.Telephony/Tizen.Telephony/Telephony.cs @@ -0,0 +1,226 @@ +/// Copyright 2016 by Samsung Electronics, Inc., +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop.Telephony; + +namespace Tizen.Telephony +{ + /// + /// Enumeration for the telephony state. + /// + public enum State + { + /// + /// Telephony state is not ready + /// + NotReady, + /// + /// Telephony state is ready + /// + Ready, + /// + /// Unavailable + /// + Unavailable + }; + + /// + /// Enumeration for the preferred voice call subscription. + /// + public enum CallPreferredVoiceSubsubscription + { + /// + /// Unknown status + /// + Unknown = -1, + /// + /// Current network + /// + CurrentNetwork = 0, + /// + /// ASK Always + /// + AskAlways, + /// + /// SIM 1 + /// + Sim1, + /// + /// SIM 2 + /// + Sim2 + }; + + /// + /// This Class provides API's to Initialize and Deinitialize the framework + /// it also provides API's to get the SlotHandle's which can then be used to get other Network/Sim/Call/Modem Information. + /// + public static class Manager + { + /// + /// Event Handler to be invoked when the telephony state changes. + /// + public static event EventHandler StateChanged + { + add + { + if (_stateChanged == null) + { + Interop.Telephony.TelephonyError error = Interop.Telephony.TelephonySetStateChangedCb(stateDelegate, IntPtr.Zero); + if (error != TelephonyError.None) + { + Log.Error(LogTag, "Add StateChanged Failed with Error: " + error); + } + + else + { + _stateChanged += value; + } + + } + } + + remove + { + _stateChanged -= value; + if (_stateChanged == null) + { + Interop.Telephony.TelephonyError error = Interop.Telephony.TelephonyUnsetStateChangedCb(stateDelegate); + if (error != TelephonyError.None) + { + Log.Error(LogTag, "Remove StateChanged Failed with Error: " + error); + } + } + } + } + + /// + /// Acquires the Number of available handles to use the telephony API. + /// + /// + /// A List of Telephony handles. + /// You will get 2 SlotHandles in case of dual SIM device. + /// where,SlotHandle at Index '0' represents Primary SIM and Index '1' represents Secondary SIM. + /// + /// + /// This Exception can will be generated in the following cases + /// 1. System is out of memory + /// 2. If the operation is not supported on device + /// 3. If the Operation Failed + /// + public static List Init() + { + //DeInitialize Previous Handles if present + if (_isInitialized) + { + Deinit(); + } + + TelephonyError err = Interop.Telephony.TelephonyInit(out _handleList); + if (err != TelephonyError.None) + { + Exception e = ExceptionFactory.CreateException(err); + // Check if error is Invalid Parameter then hide the error + if (e is ArgumentException) + { + e = new InvalidOperationException("Internal Error Occured"); + } + + throw e; + } + + int offset = 0; + for (int i = 0; i < _handleList.Count; i++) + { + _telephonyHandle.Add(new SlotHandle(Marshal.ReadIntPtr(_handleList.HandleArrayPointer, offset))); + offset += Marshal.SizeOf(_handleList.HandleArrayPointer); + } + + _isInitialized = true; + Tizen.Log.Info(Interop.Telephony.LogTag, "Returning the number of sims " + _handleList.Count); + return _telephonyHandle; + } + + /// + /// Deinitializes the telephony handles. + /// + /// + /// This Exception can be generated in the following cases + /// 1. If the operation is not supported on device + /// 2. If the Operation Failed + /// + public static void Deinit() + { + TelephonyError error = Interop.Telephony.TelephonyDeinit(ref _handleList); + if (error != TelephonyError.None) + { + Exception e = ExceptionFactory.CreateException(error); + // Check if error is Invalid Parameter then hide the error + if (e is ArgumentException) + { + e = new InvalidOperationException("Internal Error Occured"); + } + + throw e; + } + + _isInitialized = false; + _telephonyHandle.Clear(); + } + + /// + /// Acquires the telephony state value. + /// + /// + /// The state value of telephony. + /// + public static State CurrentState + { + get + { + State state = State.NotReady; + TelephonyError error = Interop.Telephony.TelephonyGetState(out state); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetState Failed with Error " + error); + return State.Unavailable; + } + + return state; + } + } + + internal static SlotHandle FindHandle(IntPtr handle) + { + SlotHandle temp = _telephonyHandle[0]; + foreach (SlotHandle simHandle in _telephonyHandle) + { + if (simHandle._handle == handle) + { + temp = simHandle; + } + } + + return temp; + } + + internal static List _telephonyHandle = new List(); + + private static StateChangedCallback stateDelegate = delegate(State state, IntPtr userData) + { + StateEventArgs args = new StateEventArgs(state); + _stateChanged?.Invoke(null, args); + }; + private static HandleList _handleList; + private static bool _isInitialized = false; + private static event EventHandler _stateChanged; + } +} diff --git a/packaging/csapi-telephony.manifest b/packaging/csapi-telephony.manifest new file mode 100644 index 0000000..75b0fa5 --- /dev/null +++ b/packaging/csapi-telephony.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/csapi-telephony.spec b/packaging/csapi-telephony.spec new file mode 100755 index 0000000..67c3bd1 --- /dev/null +++ b/packaging/csapi-telephony.spec @@ -0,0 +1,111 @@ +%{!?dotnet_assembly_path: %define dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework} +%{!?dotnet_core_path: %define dotnet_core_path %{_datadir}/tizen.net/ref} + +%if 0%{?tizen_build_devel_mode} +%define BUILDCONF Debug +%else +%define BUILDCONF Release +%endif + +Name: csapi-telephony +Summary: Tizen Telephony API for C# +Version: 1.0.0 +Release: 1 +Group: Development/Libraries +License: Apache-2.0 +URL: https://www.tizen.org +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest + +# Mono +BuildRequires: mono-compiler +BuildRequires: mono-devel + +# .NETCore +%if 0%{?_with_corefx} +AutoReqProv: no +BuildRequires: corefx-managed-32b-ref +%endif + +BuildRequires: dotnet-build-tools + +# C# API Requries +BuildRequires: csapi-tizen-devel + +%description +Tizen Telephony API for C# + +%prep +%setup -q + +cp %{SOURCE1} . + +%define Assemblies Tizen.Telephony + +%build +# Build for Net45 +for ASM in %{Assemblies}; do +if [ -e $ASM/$ASM.Net45.csproj ]; then + xbuild $ASM/$ASM.Net45.csproj \ + /p:Configuration=%{BUILDCONF} \ + /p:DotnetAssemblyPath=%{dotnet_assembly_path}/devel/net45 \ + /p:OutputPath=bin/net45 +fi + +# Build for Dotnet +%if 0%{?_with_corefx} +if [ -e $ASM/$ASM.csproj ]; then + xbuild $ASM/$ASM.csproj \ + /p:Configuration=%{BUILDCONF} \ + /p:DotnetAssemblyPath=%{dotnet_assembly_path}/devel/netstandard1.6 \ + /p:CoreFxPath=%{dotnet_core_path} \ + /p:OutputPath=bin/netstandard1.6 +fi +%endif + +# Make NuGet package +dotnet-gbs pack $ASM/$ASM.nuspec --PackageVersion=%{version} --PackageFiles=$ASM/bin + +done + +%install +mkdir -p %{buildroot}%{dotnet_assembly_path}/devel +for ASM in %{Assemblies}; do + cp -fr $ASM/bin/* %{buildroot}%{dotnet_assembly_path}/devel +%if 0%{?_with_corefx} + install -p -m 644 $ASM/bin/netstandard1.6/$ASM.dll %{buildroot}%{dotnet_assembly_path} +%else + install -p -m 644 $ASM/bin/net45/$ASM.dll %{buildroot}%{dotnet_assembly_path} +%endif +done + +mkdir -p %{buildroot}/nuget +install -p -m 644 *.nupkg %{buildroot}/nuget + +%files +%manifest %{name}.manifest +%license LICENSE +%attr(644,root,root) %{dotnet_assembly_path}/*.dll + +%package devel +Summary: Development package for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +AutoReqProv: no + +%description devel +Development package for %{name} + +%files devel +%{dotnet_assembly_path}/devel/* + +%package nuget +Summary: NuGet package for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description nuget +NuGet package for %{name} + +%files nuget +/nuget/*.nupkg -- 2.7.4