public void HandleCameraSelected(VATRPDevice device)
 {
     if ((App.CurrentAccount == null) || (device == null))
         return;
     SelectedCameraLabel.Content = device.displayName;
     string selectedCameraId = App.CurrentAccount.SelectedCameraId;
     if (!device.deviceId.Equals(selectedCameraId))
     {
         App.CurrentAccount.SelectedCameraId = device.deviceId;
         ServiceManager.Instance.ApplyMediaSettingsChanges();
         ServiceManager.Instance.SaveAccountSettings();
     }
 }
 public VATRPDevice GetSelectedSpeakers()
 {
     IntPtr deviceIdPtr = LinphoneAPI.linphone_core_get_playback_device(linphoneCore);
     if (deviceIdPtr != IntPtr.Zero)
     {
         string deviceId = LinphoneAPI.PtrToStringUtf8(deviceIdPtr);
         VATRPDevice device = new VATRPDevice(deviceId, VATRPDeviceType.SPEAKER);
         return device;
     }
     return null;
 }
        private void HandleDeviceSelected(VATRPDevice device)
        {
            this.ContentPanel.Content = null;
            if (device == null)
                return;

            switch (device.deviceType)
            {
                case VATRPDeviceType.CAMERA: HandleCameraSelected(device);
                    break;
                case VATRPDeviceType.MICROPHONE: HandleMicrophoneSelected(device);
                    break;
                case VATRPDeviceType.SPEAKER: HandleSpeakerSelected(device);
                    break;
                default: break;
            }
        }
 // VATRP-1200 TODO
 public List<VATRPDevice> GetAvailableSpeakers()
 {
     //linphone_core_get_sound_devices
     // filter with linphone_core_sound_device_can_playback
     List<VATRPDevice> speakerList = new List<VATRPDevice>();
     IntPtr soundDevicesPtr = LinphoneAPI.linphone_core_get_sound_devices(linphoneCore);
     if (soundDevicesPtr != IntPtr.Zero)
     {
         IntPtr current;
         var offset = 0;
         while ((current = Marshal.ReadIntPtr(soundDevicesPtr, offset)) != IntPtr.Zero)
         {
             string device = LinphoneAPI.PtrToStringUtf8(current);
             var strBytes = Encoding.UTF8.GetBytes(device);
             if (LinphoneAPI.linphone_core_sound_device_can_playback(linphoneCore, strBytes) == 1)
             {
                 VATRPDevice newDevice = new VATRPDevice(device, VATRPDeviceType.SPEAKER);
                 speakerList.Add(newDevice);
             }
             offset += IntPtr.Size;
         }
     }
     return speakerList;
 }
 public VATRPDevice GetSelectedMicrophone()
 {
     IntPtr deviceIdPtr = LinphoneAPI.linphone_core_get_capture_device(linphoneCore);
     if (deviceIdPtr != IntPtr.Zero)
     {
         string deviceId = LinphoneAPI.PtrToStringUtf8(deviceIdPtr);
         VATRPDevice device = new VATRPDevice(deviceId, VATRPDeviceType.MICROPHONE);
         return device;
     }
     return null;
 }
 public VATRPDevice GetSelectedCamera()
 {
     IntPtr deviceIdPtr = LinphoneAPI.linphone_core_get_video_device(linphoneCore);
     if (deviceIdPtr != IntPtr.Zero)
     {
         string deviceId = LinphoneAPI.PtrToStringUtf8(deviceIdPtr);
         VATRPDevice device = new VATRPDevice(deviceId, VATRPDeviceType.CAMERA);
         return device;
     }
     return null;
 }
        // VATRP-1200 TODO
        public List<VATRPDevice> GetAvailableCameras()
        {
            //linphone_core_get_video_devices
            List<VATRPDevice> cameraList = new List<VATRPDevice>();

            IntPtr videoDevicesPtr = LinphoneAPI.linphone_core_get_video_devices(linphoneCore);
            if (videoDevicesPtr != IntPtr.Zero)
            {
                IntPtr current;
                var offset = 0;
                while ((current = Marshal.ReadIntPtr(videoDevicesPtr, offset)) != IntPtr.Zero)
                {
                    string device = LinphoneAPI.PtrToStringUtf8(current);
                    VATRPDevice newDevice = new VATRPDevice(device, VATRPDeviceType.CAMERA);
                    cameraList.Add(newDevice);
                    offset += IntPtr.Size;
                }
            }
            return cameraList;
        }
 // VATRP-1200 TODO
 public List<VATRPDevice> GetAvailableMicrophones()
 {
     //linphone_core_get_sound_devices
     // filter with linphone_core_sound_device_can_capture
     List<VATRPDevice> microphoneList = new List<VATRPDevice>();
     IntPtr soundDevicesPtr = LinphoneAPI.linphone_core_get_sound_devices(linphoneCore);
     if (soundDevicesPtr != IntPtr.Zero)
     {
         IntPtr current;
         var offset = 0;
         while ((current = Marshal.ReadIntPtr(soundDevicesPtr, offset)) != IntPtr.Zero)
         {
             string device = LinphoneAPI.PtrToStringUtf8(current);
             if (LinphoneAPI.linphone_core_sound_device_can_capture(linphoneCore, device) == 1)
             {
                 VATRPDevice newDevice = new VATRPDevice(device, VATRPDeviceType.MICROPHONE);
                 microphoneList.Add(newDevice);
             }
             offset += IntPtr.Size;
         }
     }
     return microphoneList;
 }