2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.Runtime.InteropServices;
24 /// This class is used for managing event callbacks for notifications and properties.
26 public class TapiHandle
28 internal IntPtr _handle = IntPtr.Zero;
29 private event EventHandler<NotificationChangedEventArgs> _notificationChanged;
30 private event EventHandler<PropertyChangedEventArgs> _propertyChanged;
32 private List<Interop.Tapi.TapiNotificationCallback> _notificationChangedCbList = new List<Interop.Tapi.TapiNotificationCallback>();
33 private Interop.Tapi.TapiNotificationCallback _notificationChangedCb;
36 /// This event is called for the TAPI notification change.
38 public event EventHandler<NotificationChangedEventArgs> NotificationChanged
42 _notificationChanged += value;
47 _notificationChanged -= value;
52 /// This event is called for the TAPI property change.
54 public event EventHandler<PropertyChangedEventArgs> PropertyChanged
58 _propertyChanged += value;
63 _propertyChanged -= value;
67 internal TapiHandle(IntPtr handle)
73 /// Registers a notification callback for notification change events on DBus interface.
75 /// <param name="id">Notification id for which a callback has to be registered.</param>
76 /// <feature>http://tizen.org/feature/network.telephony</feature>
77 /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
78 /// <exception cref="ArgumentException">Thrown when it is failed due to invalid parameter.</exception>
79 /// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
80 public void RegisterNotiEvent(Notification id)
82 _notificationChangedCb = (IntPtr handle, IntPtr notiIdPtr, IntPtr data, IntPtr userData) =>
84 if (_notificationChanged != null)
87 object notiData = null;
88 Notification noti = default(Notification);
89 if (notiIdPtr != IntPtr.Zero)
91 notiId = Marshal.PtrToStringAnsi(notiIdPtr);
92 foreach (Notification n in Enum.GetValues(typeof(Notification)))
94 if (notiId == TapiUtility.ConvertNotiToString(n))
104 case Notification.IdleVoiceCall:
105 CallIdleStatusNotiStruct voiceIdleStatusNoti = Marshal.PtrToStructure<CallIdleStatusNotiStruct>(data);
106 notiData = CallStructConversions.ConvertCallIdleStatusNoti(voiceIdleStatusNoti);
108 case Notification.ActiveVoiceCall:
109 notiData = (uint)Marshal.ReadInt32(data);
111 case Notification.HeldVoiceCall:
112 notiData = (uint)Marshal.ReadInt32(data);
114 case Notification.DialingVoiceCall:
115 notiData = (uint)Marshal.ReadInt32(data);
117 case Notification.AlertVoiceCall:
118 notiData = (uint)Marshal.ReadInt32(data);
120 case Notification.IncomingVoiceCall:
121 CallIncomingInfoStruct callIncomingInfo = Marshal.PtrToStructure<CallIncomingInfoStruct>(data);
122 notiData = CallStructConversions.ConvertIncomingCallInfo(callIncomingInfo);
124 case Notification.IdleVideoCall:
125 CallIdleStatusNotiStruct videoIdleStatus = Marshal.PtrToStructure<CallIdleStatusNotiStruct>(data);
126 notiData = CallStructConversions.ConvertCallIdleStatusNoti(videoIdleStatus);
128 case Notification.ActiveVideoCall:
129 notiData = (uint)Marshal.ReadInt32(data);
131 case Notification.DialingVideoCall:
132 notiData = (uint)Marshal.ReadInt32(data);
134 case Notification.AlertVideoCall:
135 notiData = (uint)Marshal.ReadInt32(data);
137 case Notification.IncomingVideoCall:
138 CallIncomingInfoStruct videoIncomingInfo = Marshal.PtrToStructure<CallIncomingInfoStruct>(data);
139 notiData = CallStructConversions.ConvertIncomingCallInfo(videoIncomingInfo);
141 case Notification.WaitingCallInfo:
142 notiData = (uint)Marshal.ReadInt32(data);
144 case Notification.ForwardCallInfo:
145 notiData = (uint)Marshal.ReadInt32(data);
147 case Notification.BarredIncomingCallInfo:
148 notiData = (uint)Marshal.ReadInt32(data);
150 case Notification.BarredOutgoingCallInfo:
151 notiData = (uint)Marshal.ReadInt32(data);
153 case Notification.ForwardUnconditionalCallInfo:
154 notiData = (uint)Marshal.ReadInt32(data);
156 case Notification.ForwardConditionalCallInfo:
157 notiData = (uint)Marshal.ReadInt32(data);
159 case Notification.ForwardedCallInfo:
160 notiData = (uint)Marshal.ReadInt32(data);
162 case Notification.HeldCallInfo:
163 notiData = (uint)Marshal.ReadInt32(data);
165 case Notification.ActiveCallInfo:
166 notiData = (uint)Marshal.ReadInt32(data);
168 case Notification.JoinedCallInfo:
169 notiData = (uint)Marshal.ReadInt32(data);
171 case Notification.RecCallInfo:
172 CallRecordStruct recordStruct = Marshal.PtrToStructure<CallRecordStruct>(data);
173 notiData = CallStructConversions.ConvertCallRecordStruct(recordStruct);
175 case Notification.PrivacyModeCall:
176 notiData = (CallPrivacyMode)Marshal.ReadInt32(data);
178 case Notification.OtaspCall:
179 notiData = (CallOtaspStatus)Marshal.ReadInt32(data);
181 case Notification.OtapaCall:
182 notiData = (CallOtapaStatus)Marshal.ReadInt32(data);
184 case Notification.CallSignalInfo:
185 CallSignalInfoStruct signalInfoStruct = Marshal.PtrToStructure<CallSignalInfoStruct>(data);
186 notiData = CallStructConversions.ConvertCallSignalInfo(signalInfoStruct);
188 case Notification.CallSoundPath:
189 notiData = (SoundPath)Marshal.ReadInt32(data);
191 case Notification.CallSoundRingbackTone:
192 notiData = (CallSoundRingbackNoti)Marshal.ReadInt32(data);
194 case Notification.CallSoundWbamr:
195 notiData = (CallSoundWbamrNoti)Marshal.ReadInt32(data);
197 case Notification.CallSoundNoiceReduction:
198 notiData = (CallSoundNoiseReduction)Marshal.ReadInt32(data);
200 case Notification.CallSoundClock:
201 int status = Marshal.ReadInt32(data);
207 else if (status == 0)
213 case Notification.CallPreferredVoiceSubscription:
214 notiData = (CallPreferredVoiceSubscription)Marshal.ReadInt32(data);
216 case Notification.CallupgradeRequested:
217 CallUpgradeDowngradeNotiStruct upgradeNotiStruct = Marshal.PtrToStructure<CallUpgradeDowngradeNotiStruct>(data);
218 notiData = CallStructConversions.ConvertCallUpgradeNoti(upgradeNotiStruct);
220 case Notification.CallDowngraded:
221 CallUpgradeDowngradeNotiStruct downgradeNotiStruct = Marshal.PtrToStructure<CallUpgradeDowngradeNotiStruct>(data);
222 notiData = CallStructConversions.ConvertCallUpgradeNoti(downgradeNotiStruct);
224 case Notification.ModemPower:
225 notiData = (PhonePowerStatus)Marshal.ReadInt32(data);
227 case Notification.SimStatus:
228 notiData = (SimCardStatus)Marshal.ReadInt32(data);
230 case Notification.SimRefreshed:
231 notiData = (SatCmdQualiRefresh)Marshal.ReadInt32(data);
233 case Notification.SatSetupMenu:
234 SatMainMenuInfoStruct mainMenuStruct = Marshal.PtrToStructure<SatMainMenuInfoStruct>(data);
235 notiData = SatStructConversions.ConvertSatMainMenuInfoStruct(mainMenuStruct);
237 case Notification.SatDisplayText:
238 SatDisplayTextStruct textStruct = Marshal.PtrToStructure<SatDisplayTextStruct>(data);
239 notiData = SatStructConversions.ConvertSatDisplayTextStruct(textStruct);
241 case Notification.SatSelectItem:
242 SatSelectItemStruct itemStruct = Marshal.PtrToStructure<SatSelectItemStruct>(data);
243 notiData = SatStructConversions.ConvertSatSelectItemStruct(itemStruct);
245 case Notification.SatGetInKey:
246 SatGetInKeyStruct inKeyStruct = Marshal.PtrToStructure<SatGetInKeyStruct>(data);
247 notiData = SatStructConversions.ConvertSatGetInKeyStruct(inKeyStruct);
249 case Notification.SatGetInput:
250 SatGetInputStruct inputStruct = Marshal.PtrToStructure<SatGetInputStruct>(data);
251 notiData = SatStructConversions.ConvertSatGetInputStruct(inputStruct);
253 case Notification.SatRefresh:
254 SatRefreshStruct refreshStruct = Marshal.PtrToStructure<SatRefreshStruct>(data);
255 notiData = SatStructConversions.ConvertSatRefreshStruct(refreshStruct);
257 case Notification.SatSendSms:
258 SatSendSmsStruct smsStruct = Marshal.PtrToStructure<SatSendSmsStruct>(data);
259 notiData = SatStructConversions.ConvertSatSendSmsStruct(smsStruct);
261 case Notification.SatSetupEventList:
262 SatEventListDataStruct eventStruct = Marshal.PtrToStructure<SatEventListDataStruct>(data);
263 notiData = SatStructConversions.ConvertSatEventListStruct(eventStruct);
265 case Notification.SatSendDtmf:
266 SatSendDtmfDataStruct dtmfStruct = Marshal.PtrToStructure<SatSendDtmfDataStruct>(data);
267 notiData = SatStructConversions.ConvertSatSendDtmfStruct(dtmfStruct);
269 case Notification.SatEndProactiveSession:
270 notiData = (SatCommandType)Marshal.ReadInt32(data);
272 case Notification.SatCallControlResult:
273 SatCallCtrlIndDataStruct dataStruct = Marshal.PtrToStructure<SatCallCtrlIndDataStruct>(data);
274 notiData = SatStructConversions.ConvertSatCallCtrlIndDataStruct(dataStruct);
276 case Notification.SatMoSmControlResult:
277 SatMoSmsCtrlDataStruct moStruct = Marshal.PtrToStructure<SatMoSmsCtrlDataStruct>(data);
278 notiData = SatStructConversions.ConvertSatMoSmsCtrlDataStruct(moStruct);
280 case Notification.SatSetupCall:
281 SatSetupCallDataStruct callDataStruct = Marshal.PtrToStructure<SatSetupCallDataStruct>(data);
282 notiData = SatStructConversions.ConvertSatSetupCallDataStruct(callDataStruct);
284 case Notification.SatSendSs:
285 SatSendSsDataStruct ssStruct = Marshal.PtrToStructure<SatSendSsDataStruct>(data);
286 notiData = SatStructConversions.ConvertSatSendSsDataStruct(ssStruct);
288 case Notification.SatSetupUssd:
289 SatSetupUssdDataStruct ussdStruct = Marshal.PtrToStructure<SatSetupUssdDataStruct>(data);
290 notiData = SatStructConversions.ConvertSatSetupUssdDataStruct(ussdStruct);
292 case Notification.PhonebookStatus:
293 SimPhonebookStatusStruct statusStruct = Marshal.PtrToStructure<SimPhonebookStatusStruct>(data);
294 notiData = PhonebookStructConversions.ConvertSimPhonebookStatusStruct(statusStruct);
296 case Notification.PhonebookContactChange:
297 PhonebookContactChangeInfoStruct contactStruct = Marshal.PtrToStructure<PhonebookContactChangeInfoStruct>(data);
298 notiData = PhonebookStructConversions.ConvertPhonebookContactChangeStruct(contactStruct);
300 case Notification.NetworkRegistrationStatus:
301 NetworkRegistrationStatusStruct nwStruct = Marshal.PtrToStructure<NetworkRegistrationStatusStruct>(data);
302 notiData = NetworkStructConversions.ConvertNetworkRegistrationStruct(nwStruct);
304 case Notification.NetworkCellInfo:
305 NetworkCellNotiStruct notiStruct = Marshal.PtrToStructure<NetworkCellNotiStruct>(data);
306 notiData = NetworkStructConversions.ConvertNetworkCellNotiStruct(notiStruct);
308 case Notification.NetworkChange:
309 NetworkChangeNotiStruct changeStruct = Marshal.PtrToStructure<NetworkChangeNotiStruct>(data);
310 notiData = NetworkStructConversions.ConvertNetworkChangeStruct(changeStruct);
312 case Notification.NetworkTimeInfo:
313 NetworkTimeNotiStruct timeStruct = Marshal.PtrToStructure<NetworkTimeNotiStruct>(data);
314 notiData = NetworkStructConversions.ConvertNetworkTimeNotiStruct(timeStruct);
316 case Notification.NetworkIdentity:
317 NetworkIdentityNotiStruct idStruct = Marshal.PtrToStructure<NetworkIdentityNotiStruct>(data);
318 notiData = NetworkStructConversions.ConvertNetworkIdentityStruct(idStruct);
320 case Notification.NetworkSignalStrength:
321 notiData = Marshal.ReadInt32(data);
323 case Notification.NetworkEmergencyCallbackMode:
324 notiData = (NetworkEmergencyCallbackMode)Marshal.ReadInt32(data);
326 case Notification.NetworkDefaultDataSubscription:
327 notiData = (NetworkDefaultDataSubscription)Marshal.ReadInt32(data);
329 case Notification.NetworkDefaultSubscription:
330 notiData = (NetworkDefaultSubscription)Marshal.ReadInt32(data);
332 case Notification.NetworkCellId:
333 notiData = Marshal.ReadInt32(data);
335 case Notification.NetworkLac:
336 notiData = Marshal.ReadInt32(data);
338 case Notification.NetworkTac:
339 notiData = Marshal.ReadInt32(data);
341 case Notification.NetworkSystemId:
342 notiData = Marshal.ReadInt32(data);
344 case Notification.NetworkNetworkId:
345 notiData = Marshal.ReadInt32(data);
347 case Notification.NetworkBsId:
348 notiData = Marshal.ReadInt32(data);
350 case Notification.NetworkBsLatitude:
351 notiData = Marshal.ReadInt32(data);
353 case Notification.NetworkBsLongitude:
354 notiData = Marshal.ReadInt32(data);
356 case Notification.NetworkVolteStatus:
357 NetworkVolteStatusStruct volteStruct = Marshal.PtrToStructure<NetworkVolteStatusStruct>(data);
358 notiData = NetworkStructConversions.ConvertNetworkVolteStruct(volteStruct);
360 case Notification.NetworkEpdgStatus:
361 int epdgStatus = Marshal.ReadInt32(data);
367 else if (epdgStatus == 0)
373 case Notification.SsUssd:
374 SsUssdMsgInfoStruct ussdInfoStruct = Marshal.PtrToStructure<SsUssdMsgInfoStruct>(data);
375 notiData = SsStructConversions.ConvertSsMsgStruct(ussdInfoStruct);
377 case Notification.SsReleaseComplete:
378 SsReleaseCompleteMsgStruct msgStruct = Marshal.PtrToStructure<SsReleaseCompleteMsgStruct>(data);
379 notiData = SsStructConversions.ConvertReleaseMsgStruct(msgStruct);
381 case Notification.SsNotifyForwarding:
382 SsForwardResponseStruct responseStruct = Marshal.PtrToStructure<SsForwardResponseStruct>(data);
383 notiData = SsStructConversions.ConvertForwardRspStruct(responseStruct);
385 case Notification.SsNotifyBarring:
386 SsBarringResponseStruct barringStruct = Marshal.PtrToStructure<SsBarringResponseStruct>(data);
387 notiData = SsStructConversions.ConvertBarringRspStruct(barringStruct);
389 case Notification.SsNotifyWaiting:
390 SsWaitingResponseStruct waitingStruct = Marshal.PtrToStructure<SsWaitingResponseStruct>(data);
391 notiData = SsStructConversions.ConvertWaitingRspStruct(waitingStruct);
393 case Notification.SsNotifyInfo:
394 SsInfoStruct ssInfoStruct = Marshal.PtrToStructure<SsInfoStruct>(data);
395 notiData = SsStructConversions.ConvertInfoStruct(ssInfoStruct);
397 case Notification.SmsIncomingMsg:
398 SmsIncomingMsgNotiStruct smsNotiStruct = Marshal.PtrToStructure<SmsIncomingMsgNotiStruct>(data);
399 notiData = SmsStructConversions.ConvertSmsIncomingStruct(smsNotiStruct);
401 case Notification.SmsIncomingCbMsg:
402 SmsIncomingCbMsgNotiStruct smsCbStruct = Marshal.PtrToStructure<SmsIncomingCbMsgNotiStruct>(data);
403 notiData = SmsStructConversions.ConvertSmsIncomingCbStruct(smsCbStruct);
405 case Notification.SmsIncomingEtwsMsg:
406 SmsIncomingEtwsMsgNotiStruct etwsStruct = Marshal.PtrToStructure<SmsIncomingEtwsMsgNotiStruct>(data);
407 notiData = SmsStructConversions.ConvertSmsIncomingEtwsStruct(etwsStruct);
409 case Notification.SmsMemoryStatus:
410 notiData = (SmsMemoryStatus)Marshal.ReadInt32(data);
412 case Notification.SmsReady:
413 notiData = (SmsReadyStatus)Marshal.ReadInt32(data);
415 case Notification.OemData:
416 OemDataStruct oemStruct = Marshal.PtrToStructure<OemDataStruct>(data);
417 notiData = OemStructConversions.ConvertOemStruct(oemStruct);
421 _notificationChanged(null, new NotificationChangedEventArgs(noti, notiData));
425 _notificationChangedCbList.Add(_notificationChangedCb);
427 int ret = Interop.Tapi.RegisterNotiEvent(_handle, TapiUtility.ConvertNotiToString(id), _notificationChangedCb, IntPtr.Zero);
428 if (ret != (int)TapiError.Success)
430 Log.Error(TapiUtility.LogTag, "Failed to register notification event, Error: " + (TapiError)ret);
431 TapiUtility.ThrowTapiException(ret, _handle);
436 /// Registers a notification callback for property change events on DBus interface.
438 /// <param name="property">Property definition for which a callback has to be registered.</param>
439 /// <feature>http://tizen.org/feature/network.telephony</feature>
440 /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
441 /// <exception cref="ArgumentException">Thrown when it is failed due to invalid parameter.</exception>
442 /// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
443 public void RegisterPropEvent(Property property)
445 _notificationChangedCb = (IntPtr handle, IntPtr propPtr, IntPtr data, IntPtr userData) =>
447 if (_propertyChanged != null)
450 object propData = null;
451 Property propertyId = default(Property);
452 if (propPtr != IntPtr.Zero)
454 prop = Marshal.PtrToStringAnsi(propPtr);
455 foreach (Property p in Enum.GetValues(typeof(Property)))
457 if (prop == TapiUtility.ConvertPropToString(p))
467 case Property.ModemPower:
468 propData = (PhonePowerStatus)Marshal.ReadInt32(data);
470 case Property.ModemDongleStatus:
471 int dongleStatus = Marshal.ReadInt32(data);
472 if (dongleStatus == 1)
477 else if (dongleStatus == 0)
483 case Property.ModemDongleLogin:
484 int loginStatus = Marshal.ReadInt32(data);
485 if (loginStatus == 1)
490 else if (loginStatus == 0)
496 case Property.SimCallForwardState:
497 int forwardState = Marshal.ReadInt32(data);
498 if (forwardState == 1)
503 else if (forwardState == 0)
509 case Property.NetworkLac:
510 propData = (uint)Marshal.ReadInt32(data);
512 case Property.NetworkTac:
513 propData = (uint)Marshal.ReadInt32(data);
515 case Property.NetworkPlmn:
516 propData = Marshal.PtrToStringAnsi(data);
518 case Property.NetworkCellId:
519 propData = (uint)Marshal.ReadInt32(data);
521 case Property.NetworkPhysicalCellId:
522 propData = (uint)Marshal.ReadInt32(data);
524 case Property.NetworkServiceType:
525 propData = (NetworkServiceType)Marshal.ReadInt32(data);
527 case Property.NetworkAct:
528 propData = (NetworkSystemType)Marshal.ReadInt32(data);
530 case Property.NetworkPsType:
531 propData = (NetworkPsType)Marshal.ReadInt32(data);
533 case Property.NetworkCircuitStatus:
534 propData = (NetworkServiceLevel)Marshal.ReadInt32(data);
536 case Property.NetworkPacketStatus:
537 propData = (NetworkServiceLevel)Marshal.ReadInt32(data);
539 case Property.NetworkRoamingStatus:
540 int roamingStatus = Marshal.ReadInt32(data);
541 if (roamingStatus == 1)
546 else if (roamingStatus == 0)
552 case Property.NetworkNameOption:
553 propData = (NetworkNameDisplayCondition)Marshal.ReadInt32(data);
555 case Property.NetworkName:
556 propData = Marshal.PtrToStringAnsi(data);
558 case Property.NetworkSpnName:
559 propData = Marshal.PtrToStringAnsi(data);
561 case Property.NetworkSignalDbm:
562 propData = Marshal.ReadInt32(data);
564 case Property.NetworkSignalLevel:
565 propData = Marshal.ReadInt32(data);
567 case Property.NetworkImsVoiceStatus:
568 int imsStatus = Marshal.ReadInt32(data);
574 else if (imsStatus == 0)
580 case Property.NetworkVolteEnable:
581 propData = (VolteNetworkType)Marshal.ReadInt32(data);
583 case Property.NetworkLteBand:
584 propData = (NetworkLteBandType)Marshal.ReadInt32(data);
588 _propertyChanged(null, new PropertyChangedEventArgs(propertyId, propData));
592 _notificationChangedCbList.Add(_notificationChangedCb);
593 int ret = Interop.Tapi.RegisterNotiEvent(_handle, TapiUtility.ConvertPropToString(property), _notificationChangedCb, IntPtr.Zero);
594 if (ret != (int)TapiError.Success)
596 Log.Error(TapiUtility.LogTag, "Failed to register notification event for property change, Error: " + (TapiError)ret);
597 TapiUtility.ThrowTapiException(ret, _handle);
602 /// Deregisters notification callback for notification change events on DBus interface.
604 /// <param name="id">Notification id for which the callback has to be de-registered.</param>
605 /// <feature>http://tizen.org/feature/network.telephony</feature>
606 /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
607 /// <exception cref="ArgumentException">Thrown when it is failed due to invalid parameter.</exception>
608 /// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
609 public void DeregisterNotiEvent(Notification id)
611 int ret = Interop.Tapi.DeregisterNotiEvent(_handle, TapiUtility.ConvertNotiToString(id));
612 if (ret != (int)TapiError.Success)
614 Log.Error(TapiUtility.LogTag, "Failed to deregister notification event, Error: " + (TapiError)ret);
615 TapiUtility.ThrowTapiException(ret, _handle);
620 /// Deregisters notification callback for property change events on DBus interface.
622 /// <param name="property">Property definition for which the callback has to be de-registered.</param>
623 /// <feature>http://tizen.org/feature/network.telephony</feature>
624 /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
625 /// <exception cref="ArgumentException">Thrown when it is failed due to invalid parameter.</exception>
626 /// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
627 public void DeregisterPropEvent(Property property)
629 int ret = Interop.Tapi.DeregisterNotiEvent(_handle, TapiUtility.ConvertPropToString(property));
630 if (ret != (int)TapiError.Success)
632 Log.Error(TapiUtility.LogTag, "Failed to deregister notification event for property change, Error: " + (TapiError)ret);
633 TapiUtility.ThrowTapiException(ret, _handle);
638 /// Gets the property value in an integer format for the given property.
640 /// <param name="property">The property to be retrieved from Dbus.</param>
641 /// <returns>The property value in integer format.</returns>
642 /// <feature>http://tizen.org/feature/network.telephony</feature>
643 /// <privilege>http://tizen.org/privilege/telephony</privilege>
644 /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
645 /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
646 /// <exception cref="ArgumentException">Thrown when it is failed due to invalid parameter.</exception>
647 /// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
648 public int GetIntProperty(Property property)
651 int ret = Interop.Tapi.GetIntProperty(_handle, TapiUtility.ConvertPropToString(property), out result);
652 if (ret != (int)TapiError.Success)
654 Log.Error(TapiUtility.LogTag, "Failed to get property in integer format, Error: " + (TapiError)ret);
655 TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
662 /// Gets the property value in a string format for the given property.
664 /// <param name="property">The property to be retrieved from Dbus.</param>
665 /// <returns>The property value in string format.</returns>
666 /// <feature>http://tizen.org/feature/network.telephony</feature>
667 /// <privilege>http://tizen.org/privilege/telephony</privilege>
668 /// <exception cref="NotSupportedException">Thrown when telephony feature is not supported.</exception>
669 /// <exception cref="UnauthorizedAccessException">Thrown when permission is denied.</exception>
670 /// <exception cref="ArgumentException">Thrown when it is failed due to invalid parameter.</exception>
671 /// <exception cref="InvalidOperationException">Thrown when it is failed due to invalid operation.</exception>
672 public string GetStringProperty(Property property)
675 int ret = Interop.Tapi.GetStringProperty(_handle, TapiUtility.ConvertPropToString(property), out result);
676 if (ret != (int)TapiError.Success)
678 Log.Error(TapiUtility.LogTag, "Failed to get property in string format, Error: " + (TapiError)ret);
679 TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");