summaryrefslogtreecommitdiff
path: root/src/Tizen.Telephony/Interop
diff options
context:
space:
mode:
Diffstat (limited to 'src/Tizen.Telephony/Interop')
-rwxr-xr-xsrc/Tizen.Telephony/Interop/Interop.Call.cs87
-rwxr-xr-xsrc/Tizen.Telephony/Interop/Interop.Libraries.cs29
-rwxr-xr-xsrc/Tizen.Telephony/Interop/Interop.Modem.cs39
-rwxr-xr-xsrc/Tizen.Telephony/Interop/Interop.Network.cs90
-rwxr-xr-xsrc/Tizen.Telephony/Interop/Interop.Sim.cs66
-rwxr-xr-xsrc/Tizen.Telephony/Interop/Interop.Telephony.cs78
6 files changed, 389 insertions, 0 deletions
diff --git a/src/Tizen.Telephony/Interop/Interop.Call.cs b/src/Tizen.Telephony/Interop/Interop.Call.cs
new file mode 100755
index 0000000..c5cf929
--- /dev/null
+++ b/src/Tizen.Telephony/Interop/Interop.Call.cs
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Tizen.Telephony;
+using static Tizen.Telephony.CallHandle;
+
+/// <summary>
+/// Partial Interop Class
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Call Interop Class
+ /// </summary>
+ internal static partial class Call
+ {
+ [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_preferred_voice_subscription")]
+ internal static extern Telephony.TelephonyError GetPreferredVoiceSubscription(IntPtr handle, out CallPreferredVoiceSubscription 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/src/Tizen.Telephony/Interop/Interop.Libraries.cs b/src/Tizen.Telephony/Interop/Interop.Libraries.cs
new file mode 100755
index 0000000..b98e7d0
--- /dev/null
+++ b/src/Tizen.Telephony/Interop/Interop.Libraries.cs
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+/// <summary>
+/// Partial Interop Class
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Libraries Interop Class
+ /// </summary>
+ internal static partial class Libraries
+ {
+ public const string Telephony = "libcapi-telephony.so.0";
+ }
+} \ No newline at end of file
diff --git a/src/Tizen.Telephony/Interop/Interop.Modem.cs b/src/Tizen.Telephony/Interop/Interop.Modem.cs
new file mode 100755
index 0000000..19034b0
--- /dev/null
+++ b/src/Tizen.Telephony/Interop/Interop.Modem.cs
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+/// <summary>
+/// Partial Interop Class
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Modem Interop Class
+ /// </summary>
+ 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/src/Tizen.Telephony/Interop/Interop.Network.cs b/src/Tizen.Telephony/Interop/Interop.Network.cs
new file mode 100755
index 0000000..e8bbaf0
--- /dev/null
+++ b/src/Tizen.Telephony/Interop/Interop.Network.cs
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+/// <summary>
+/// Partial Interop Class
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Network Interop Class
+ /// </summary>
+ 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/src/Tizen.Telephony/Interop/Interop.Sim.cs b/src/Tizen.Telephony/Interop/Interop.Sim.cs
new file mode 100755
index 0000000..7e8c9f2
--- /dev/null
+++ b/src/Tizen.Telephony/Interop/Interop.Sim.cs
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+/// <summary>
+/// Partial Interop Class
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Sim Interop Class
+ /// </summary>
+ 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/src/Tizen.Telephony/Interop/Interop.Telephony.cs b/src/Tizen.Telephony/Interop/Interop.Telephony.cs
new file mode 100755
index 0000000..446703d
--- /dev/null
+++ b/src/Tizen.Telephony/Interop/Interop.Telephony.cs
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Tizen.Telephony;
+
+/// <summary>
+/// Partial Interop Class
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Telephony Interop Class
+ /// </summary>
+ 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