/// <summary> /// Initializes a new instance of the Radio class. /// </summary> /// <exception cref="NotSupportedException">The radio feature is not supported.</exception> /// <since_tizen> 3 </since_tizen> public Radio() { ValidateFeatureSupported(FeatureFmRadio); Native.Create(out _handle); try { InitCallbacks(); Native.SetScanCompletedCb(_handle, _scanCompletedCallback). ThrowIfFailed("Failed to initialize radio"); Native.SetInterruptedCb(_handle, _interruptedCallback). ThrowIfFailed("Failed to initialize radio"); } catch (Exception) { _handle.Dispose(); throw; } }
/// <summary> /// Stops the radio scanning. /// </summary> /// <remarks>The radio must be in the <see cref="RadioState.Scanning"/> state.</remarks> /// <exception cref="InvalidOperationException">The radio is not in the valid state.</exception> /// <seealso cref="ScanStopped"/> /// <since_tizen> 3 </since_tizen> public void StopScan() { ValidateRadioState(RadioState.Scanning); Native.ScanStop(Handle, _scanStoppedCallback).ThrowIfFailed("Failed to stop scanning"); }
/// <summary> /// Stops the radio. /// </summary> /// <remarks>The radio must be in the <see cref="RadioState.Playing"/> state.</remarks> /// <exception cref="InvalidOperationException">The radio is not in the valid state.</exception> /// <since_tizen> 3 </since_tizen> public void Stop() { ValidateRadioState(RadioState.Playing); Native.Stop(Handle).ThrowIfFailed("Failed to stop radio"); }
/// <summary> /// Starts the radio scanning and triggers the <see cref="ScanUpdated"/> event when the scan information is updated. /// </summary> /// <remarks>The radio must be in the <see cref="RadioState.Ready"/> or <see cref="RadioState.Playing"/> state.</remarks> /// <exception cref="InvalidOperationException">The radio is not in the valid state.</exception> /// <seealso cref="ScanUpdated"/> /// <seealso cref="ScanCompleted"/> /// <since_tizen> 3 </since_tizen> public void StartScan() { ValidateRadioState(RadioState.Ready, RadioState.Playing); Native.ScanStart(Handle, _scanUpdatedCallback).ThrowIfFailed("Failed to start scanning"); }
/// <summary> /// Starts the radio. /// </summary> /// <remarks>The radio must be in the <see cref="RadioState.Ready"/> state.</remarks> /// <exception cref="InvalidOperationException">The radio is not in the valid state.</exception> /// <since_tizen> 3 </since_tizen> public void Start() { ValidateRadioState(RadioState.Ready); Native.Start(Handle).ThrowIfFailed("Failed to start radio"); }