/* * 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.Collections.Generic; namespace Tizen.Network.Bluetooth { /// /// An extended EventArgs class contains the changed Bluetooth state. /// public class StateChangedEventArgs : EventArgs { private BluetoothState _type; private BluetoothError _result; internal StateChangedEventArgs(BluetoothError result, BluetoothState type) { _type = type; _result = result; } /// /// The state of Bluetooth. /// public BluetoothState BTState { get { return _type; } } /// /// The BluetoothError result. /// public BluetoothError Result { get { return _result; } } } /// /// An extended EventArgs class contains the changed Bluetooth name. /// public class NameChangedEventArgs : EventArgs { private string _name; internal NameChangedEventArgs(string name) { _name = name; } /// /// The name of the device. /// public string DeviceName { get { return _name; } } } /// /// An extended EventArgs class contains the changed Bluetooth visibility mode. /// public class VisibilityModeChangedEventArgs : EventArgs { private VisibilityMode _mode; private BluetoothError _result; internal VisibilityModeChangedEventArgs(BluetoothError result, VisibilityMode mode) { _result = result; _mode = mode; } /// /// The visibility mode. /// public VisibilityMode Visibility { get { return _mode; } } /// /// The BluetoothError result. /// public BluetoothError Result { get { return _result; } } } /// /// An extended EventArgs class contains the duration until the visibility mode is changed from TimeLimitedDiscoverable to NonDiscoverable. /// public class VisibilityDurationChangedEventArgs : EventArgs { private int _duration; internal VisibilityDurationChangedEventArgs(int duration) { _duration = duration; } /// /// The duration. /// public int Duration { get { return _duration; } } } /// /// An extended EventArgs class contains the changed Bluetooth device discovery state and the discovered device information. /// public class DiscoveryStateChangedEventArgs : EventArgs { private BluetoothError _result; private BluetoothDeviceDiscoveryState _state; private BluetoothDevice _device; internal DiscoveryStateChangedEventArgs(BluetoothError result, BluetoothDeviceDiscoveryState state) { _result = result; _state = state; } internal DiscoveryStateChangedEventArgs(BluetoothError result, BluetoothDeviceDiscoveryState state, BluetoothDevice device) { _result = result; _state = state; _device = device; } /// /// The BluetoothError result. /// public BluetoothError Result { get { return _result; } } /// /// The state of the discovery. /// public BluetoothDeviceDiscoveryState DiscoveryState { get { return _state; } } /// /// The remote device found. /// public BluetoothDevice DeviceFound { get { return _device; } } } /// /// An extended EventArgs class contains the bonded device information. /// public class BondCreatedEventArgs : EventArgs { private BluetoothError _result; private BluetoothDevice _device; internal BondCreatedEventArgs(BluetoothError result, BluetoothDevice device) { _result = result; _device = device; } /// /// The BluetoothError result. /// public BluetoothError Result { get { return _result; } } /// /// The remote device. /// public BluetoothDevice Device { get { return _device; } } } /// /// An extended EventArgs class contains the address of the remote Bluetooth device to destroy bond with. /// public class BondDestroyedEventArgs : EventArgs { private BluetoothError _result; private string _address; internal BondDestroyedEventArgs(BluetoothError result, string address) { _result = result; _address = address; } /// /// The BluetoothError result. /// public BluetoothError Result { get { return _result; } } /// /// The remote device address. /// /// The device address. public string DeviceAddress { get { return _address; } } } /// /// An extended EventArgs class contains the authorization state and the address of the remote Bluetooth device. /// public class AuthorizationChangedEventArgs : EventArgs { private BluetoothAuthorizationType _authType; private string _address; internal AuthorizationChangedEventArgs(BluetoothAuthorizationType authType, string address) { _authType = authType; _address = address; } /// /// The authorization. /// public BluetoothAuthorizationType Authorization { get { return _authType; } } /// /// The device address. /// public string DeviceAddress { get { return _address; } } } /// /// An extended EventArgs class contains the service lists found on the remote Bluetooth device. /// public class ServiceSearchedEventArgs : EventArgs { private BluetoothDeviceSdpData _sdpData; private BluetoothError _result; internal ServiceSearchedEventArgs(BluetoothError result, BluetoothDeviceSdpData sdpData) { _result = result; _sdpData = sdpData; } /// /// The BluetoothError result. /// public BluetoothError Result { get { return _result; } } /// /// The sdp data. /// public BluetoothDeviceSdpData SdpData { get { return _sdpData; } } } /// /// An extended EventArgs class contains the connection state and the connection information of the remote device. /// public class DeviceConnectionStateChangedEventArgs : EventArgs { private bool _isConnected; private BluetoothDeviceConnectionData _connectionData; internal DeviceConnectionStateChangedEventArgs(bool isConnected, BluetoothDeviceConnectionData connectionData) { _isConnected = isConnected; _connectionData = connectionData; } /// /// A value indicating whether the device is connected. /// public bool IsConnected { get { return _isConnected; } } /// /// The device connection data. /// public BluetoothDeviceConnectionData ConnectionData { get { return _connectionData; } } } /// /// An extended EventArgs class contains the data received information. /// public class SocketDataReceivedEventArgs : EventArgs { private SocketData _data; internal SocketDataReceivedEventArgs(SocketData data) { _data = data; } /// /// The socket data. /// public SocketData Data { get { return _data; } } } /// /// An extended EventArgs class contains the changed connection state. /// public class SocketConnectionStateChangedEventArgs : EventArgs { private BluetoothError _result; private BluetoothSocketState _state; private SocketConnection _connection; internal SocketConnectionStateChangedEventArgs(BluetoothError result, BluetoothSocketState state, SocketConnection connection) { _result = result; _state = state; _connection = connection; } /// /// The BluetoothError result. /// public BluetoothError Result { get { return _result; } } /// /// The socket state. /// public BluetoothSocketState State { get { return _state; } } /// /// The socket connection. /// public SocketConnection Connection { get { return _connection; } } } /// /// The AcceptStateChanged event is raised when the socket connection state is changed. /// public class AcceptStateChangedEventArgs : EventArgs { private BluetoothError _result; private BluetoothSocketState _state; private SocketConnection _connection; private IBluetoothServerSocket _server; internal AcceptStateChangedEventArgs(BluetoothError result, BluetoothSocketState state, SocketConnection connection, BluetoothSocket server) { _result = result; _state = state; _connection = connection; _server = (IBluetoothServerSocket)server; } /// /// The BluetoothError result. /// public BluetoothError Result { get { return _result; } } /// /// The socket state. /// public BluetoothSocketState State { get { return _state; } } /// /// The socket connection. /// public SocketConnection Connection { get { return _connection; } } /// /// The server socket instance. /// public IBluetoothServerSocket Server { get { return _server; } } } /// /// An extended EventArgs class contains the connection state, remote address, and the type of audio profile. /// public class AudioConnectionStateChangedEventArgs : EventArgs { private int _result; private bool _isConnected; private string _address; private BluetoothAudioProfileType _type; internal AudioConnectionStateChangedEventArgs(int result, bool isConnected, string address, BluetoothAudioProfileType type) { _result = result; _type = type; _isConnected = isConnected; _address = address; } /// /// The result. /// public int Result { get { return _result; } } /// /// A value indicating whether this instance is connected. /// public bool IsConnected { get { return _isConnected; } } /// /// The address. /// public string Address { get { return _address; } } /// /// The type of the audio profile. /// public BluetoothAudioProfileType ProfileType { get { return _type; } } } /// /// An extended EventArgs class contains the connection state and the address of the remote Bluetooth device. /// public class HidConnectionStateChangedEventArgs : EventArgs { private int _result; private bool _isConnected; private string _address; internal HidConnectionStateChangedEventArgs(int result, bool isConnected, string address) { _result = result; _isConnected = isConnected; _address = address; } /// /// The result. /// public int Result { get { return _result; } } /// /// A value indicating whether this instance is connected. /// public bool IsConnected { get { return _isConnected; } } /// /// The address. /// public string Address { get { return _address; } } } /// /// An extended EventArgs class contains the changed equalizer state. /// public class EqualizerStateChangedEventArgs : EventArgs { private EqualizerState _state; internal EqualizerStateChangedEventArgs(EqualizerState state) { _state = state; } /// /// The state of the equalizer. /// public EqualizerState State { get { return _state; } } } /// /// An extended EventArgs class contains the changed repeat mode. /// public class RepeatModeChangedEventArgs : EventArgs { private RepeatMode _mode; internal RepeatModeChangedEventArgs(RepeatMode mode) { _mode = mode; } /// /// The repeat mode. /// public RepeatMode Mode { get { return _mode; } } } /// /// An extended EventArgs class contains the changed shuffle mode. /// public class ShuffleModeChangedeventArgs : EventArgs { private ShuffleMode _mode; internal ShuffleModeChangedeventArgs(ShuffleMode mode) { _mode = mode; } /// /// The shuffle mode. /// public ShuffleMode Mode { get { return _mode; } } } /// /// An extended EventArgs class contains the changed scan mode. /// public class ScanModeChangedEventArgs : EventArgs { private ScanMode _mode; internal ScanModeChangedEventArgs(ScanMode mode) { _mode = mode; } /// /// The scan mode. /// public ScanMode Mode { get { return _mode; } } } /// /// An extended EventArgs class contains the connection state and the remote device address. /// public class TargetConnectionStateChangedEventArgs : EventArgs { private bool _isConnected; private string _address; internal TargetConnectionStateChangedEventArgs(bool isConnected, string address) { _isConnected = isConnected; _address = address; } /// /// A value indicating whether this instance is connected. /// public bool IsConnected { get { return _isConnected; } } /// /// The address. /// public string Address { get { return _address; } } } /// /// An extended EventArgs class contains the changed Bluetooth LE advertising state changed information. /// public class AdvertisingStateChangedEventArgs : EventArgs { private BluetoothLeAdvertisingState _state; private int _result; private IntPtr _advertiserHandle; //TODO : Add conversion code from IntPtr to BluetoothLeAdvertiser class later internal AdvertisingStateChangedEventArgs(int result, IntPtr advertiserHandle, BluetoothLeAdvertisingState state) { _result = result; _advertiserHandle = advertiserHandle; _state = state; } /// /// The result. /// public int Result { get { return _result; } } /// /// The advertiser handle. /// public IntPtr AdvertiserHandle { get { return _advertiserHandle; } } /// /// The LE advertising state. /// public BluetoothLeAdvertisingState State { get { return _state; } } } /// /// An extended EventArgs class contains the changed Bluetooth LE scan result information. /// public class AdapterLeScanResultChangedEventArgs : EventArgs { private BluetoothLeDevice _deviceData; private BluetoothError _result; internal AdapterLeScanResultChangedEventArgs(BluetoothError result, BluetoothLeDevice deviceData) { _deviceData = deviceData; _result = result; } /// /// The result. /// public BluetoothError Result { get { return _result; } } /// /// The LE device data. /// public BluetoothLeDevice DeviceData { get { return _deviceData; } } } /// /// An extended EventArgs class contains the changed Bluetooth LE GATT connection state. /// public class GattConnectionStateChangedEventArgs : EventArgs { private bool _isConnected; private int _result; private string _remoteAddress; internal GattConnectionStateChangedEventArgs(int result, bool connected, string remoteAddress) { _isConnected = connected; _result = result; _remoteAddress = remoteAddress; } /// /// The result. /// public int Result { get { return _result; } } /// /// A value indicating whether this instance is connected. /// public bool IsConnected { get { return _isConnected; } } /// /// The remote address. /// public string RemoteAddress { get { return _remoteAddress; } } } /// /// An extended EventArgs class contains the changed attribute value. /// public class ValueChangedEventArgs : EventArgs { internal ValueChangedEventArgs(byte[] value) { Value = value; } /// /// The attribute value. /// public byte[] Value { get; } } /// /// An extended EventArgs class contains the read value request data. /// public class ReadRequestedEventArgs : EventArgs { internal ReadRequestedEventArgs(BluetoothGattServer server, string clientAddress, int requestId, int offset) { Server = server; ClientAddress = clientAddress; RequestId = requestId; Offset = offset; } /// /// The GATT server instance. /// public BluetoothGattServer Server { get; } /// /// The client address. /// public string ClientAddress { get; } /// /// The request identifier. /// public int RequestId { get; } /// /// The offset. /// public int Offset { get; } } /// /// An extended EventArgs class contains the read value request data. /// public class WriteRequestedEventArgs : EventArgs { internal WriteRequestedEventArgs(BluetoothGattServer server, string clientAddress, int requestId, byte[] value, int offset, bool response_needed) { Server = server; ClientAddress = clientAddress; RequestId = requestId; Value = value; Offset = offset; Response_needed = response_needed; } /// /// The GATT server instance. /// public BluetoothGattServer Server { get; } /// /// The client address. /// public string ClientAddress { get; } /// /// The request identifier. /// public int RequestId { get; } /// /// The read value. /// public byte[] Value { get; } /// /// The offset. /// public int Offset { get; } /// /// Indicates whether a response is required by the remote device. /// public bool Response_needed { get; } } /// /// An extended EventArgs class contains the client preference to enable or disable the Notification/Indication. /// public class NotificationStateChangedEventArg : EventArgs { internal NotificationStateChangedEventArg(BluetoothGattServer server, bool value) { Server = server; Value = value; } /// /// The GATT server instance. /// public BluetoothGattServer Server { get; } /// /// A value indicating whether the notification is enabled. /// public bool Value { get; } } /// /// An extended EventArgs class contains the read value request data. /// public class NotificationSentEventArg : EventArgs { internal NotificationSentEventArg(BluetoothGattServer server, string clientAddress, int result, bool completed) { Result = result; ClientAddress = clientAddress; Server = server; Completed = completed; } /// /// The GATT server instance. /// public BluetoothGattServer Server { get; } /// /// The client address. /// public string ClientAddress { get; } /// /// The result. /// public int Result { get; } /// /// Gets a value indicating whether the notification sent is completed. /// public bool Completed { get; } } /// /// An extended EventArgs class which contains the connection state and address of the remote Bluetooth device. /// public class ConnectionRequestedEventArgs : EventArgs { private string _address; internal ConnectionRequestedEventArgs(string address) { _address = address; } /// /// The address. /// public string Address { get { return _address; } } } /// /// An extended EventArgs class which contains the file transfer progress state, file transfer progress by percent. /// public class TransferProgressEventArgs : EventArgs { private string _file; private long _size; private int _percent; internal TransferProgressEventArgs(string file, long size, int percent) { _file = file; _size = size; _percent = percent; } /// /// The File name. /// public string File { get { return _file; } } /// /// The File size. /// public long Size { get { return _size; } } /// /// The File transfer percent. /// public int Percent { get { return _percent; } } } /// /// An extended EventArgs class which contains the file transfer finished state and file state. /// public class TransferFinishedEventArgs : EventArgs { private string _file; private long _size; private int _result; internal TransferFinishedEventArgs(int result, string file, long size) { _file = file; _size = size; _result = result; } /// /// The File name. /// public string File { get { return _file; } } /// /// The File size. /// public long Size { get { return _size; } } /// /// The return value. /// public int Result { get { return _result; } } } /// /// An extended EventArgs class which contains the Push Request respond state /// public class PushRespondedEventArgs : EventArgs { int _result; string _address; internal PushRespondedEventArgs(int result, string address) { _address = address; _result = result; } /// /// The return value. /// public int Result { get { return _result; } } /// /// The address. /// public string Address { get { return _address; } } } /// /// An extended EventArgs class which contains the file push progress state, push progress by percent. /// public class PushProgressEventArgs : EventArgs { private string _file; private long _size; private int _percent; internal PushProgressEventArgs(string file, long size, int percent) { _file = file; _size = size; _percent = percent; } /// /// The File name. /// public string File { get { return _file; } } /// /// The File size. /// public long Size { get { return _size; } } /// /// The File transfer percent. /// public int Percent { get { return _percent; } } } /// /// An extended EventArgs class which contains the Push Request respond state /// public class PushFinishedEventArgs : EventArgs { int _result; string _address; internal PushFinishedEventArgs(int result, string address) { _address = address; _result = result; } /// /// The return value. /// public int Result { get { return _result; } } /// /// The address. /// public string Address { get { return _address; } } } }