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;
20 namespace Tizen.Network.Bluetooth
23 /// An extended EventArgs class which contains changed Bluetooth state.
25 public class StateChangedEventArgs : EventArgs
27 private BluetoothState _type;
28 private BluetoothError _result;
30 internal StateChangedEventArgs(BluetoothError result, BluetoothState type)
37 /// The state of Bluetooth.
39 public BluetoothState BTState
48 /// The BluetoothError result.
50 public BluetoothError Result
60 /// An extended EventArgs class which contains changed Bluetooth name.
62 public class NameChangedEventArgs : EventArgs
66 internal NameChangedEventArgs(string name)
72 /// The name of the device.
74 public string DeviceName
84 /// An extended EventArgs class which contains changed Bluetooth visibility mode.
86 public class VisibilityModeChangedEventArgs : EventArgs
88 private VisibilityMode _mode;
89 private BluetoothError _result;
91 internal VisibilityModeChangedEventArgs(BluetoothError result, VisibilityMode mode)
98 /// The visibility mode.
100 public VisibilityMode Visibility
109 /// The BluetoothError result.
111 public BluetoothError Result
121 /// An extended EventArgs class which contains the duration until the visibility mode is changed from TimeLimitedDiscoverable to NonDiscoverable.
123 public class VisibilityDurationChangedEventArgs : EventArgs
125 private int _duration;
127 internal VisibilityDurationChangedEventArgs(int duration)
129 _duration = duration;
145 /// An extended EventArgs class which contains changed Bluetooth device discovery state and the discovered device information.
147 public class DiscoveryStateChangedEventArgs : EventArgs
149 private BluetoothError _result;
150 private BluetoothDeviceDiscoveryState _state;
151 private BluetoothDevice _device;
153 internal DiscoveryStateChangedEventArgs(BluetoothError result, BluetoothDeviceDiscoveryState state)
159 internal DiscoveryStateChangedEventArgs(BluetoothError result, BluetoothDeviceDiscoveryState state, BluetoothDevice device)
167 /// The BluetoothError result.
169 public BluetoothError Result
178 /// The state of the discovery.
180 public BluetoothDeviceDiscoveryState DiscoveryState
189 /// The remote device found.
191 public BluetoothDevice DeviceFound
201 /// An extended EventArgs class which contains the bonded device information.
203 public class BondCreatedEventArgs : EventArgs
205 private BluetoothError _result;
206 private BluetoothDevice _device;
208 internal BondCreatedEventArgs(BluetoothError result, BluetoothDevice device)
215 /// The BluetoothError result.
217 public BluetoothError Result
226 /// The remote device.
228 public BluetoothDevice Device
238 /// An extended EventArgs class which contains the address of the remote Bluetooth device to destroy bond with.
240 public class BondDestroyedEventArgs : EventArgs
242 private BluetoothError _result;
243 private string _address;
245 internal BondDestroyedEventArgs(BluetoothError result, string address)
252 /// The BluetoothError result.
254 public BluetoothError Result
263 /// The remote device address.
265 /// <value>The device address.</value>
266 public string DeviceAddress
276 /// An extended EventArgs class which contains the authorization state and address of the remote Bluetooth device.
278 public class AuthorizationChangedEventArgs : EventArgs
280 private BluetoothAuthorizationType _authType;
281 private string _address;
283 internal AuthorizationChangedEventArgs(BluetoothAuthorizationType authType, string address)
285 _authType = authType;
290 /// The authorization.
292 public BluetoothAuthorizationType Authorization
301 /// The device address.
303 public string DeviceAddress
314 /// An extended EventArgs class which contains the service lists found on the remote Bluetooth device.
316 public class ServiceSearchedEventArgs : EventArgs
318 private BluetoothDeviceSdpData _sdpData;
319 private BluetoothError _result;
321 internal ServiceSearchedEventArgs(BluetoothError result, BluetoothDeviceSdpData sdpData)
328 /// The BluetoothError result.
330 public BluetoothError Result
340 public BluetoothDeviceSdpData SdpData
350 /// An extended EventArgs class which contains the connection state and connection information of the remote device.
352 public class DeviceConnectionStateChangedEventArgs : EventArgs
354 private bool _isConnected;
355 private BluetoothDeviceConnectionData _connectionData;
357 internal DeviceConnectionStateChangedEventArgs(bool isConnected, BluetoothDeviceConnectionData connectionData)
359 _isConnected = isConnected;
360 _connectionData = connectionData;
364 /// A value indicating whether the device is connected.
366 public bool IsConnected
375 /// The device connection data.
377 public BluetoothDeviceConnectionData ConnectionData
381 return _connectionData;
387 /// An extended EventArgs class which contains data received information.
389 public class SocketDataReceivedEventArgs : EventArgs
391 private SocketData _data;
393 internal SocketDataReceivedEventArgs(SocketData data)
401 public SocketData Data
411 /// An extended EventArgs class which contains changed connection state.
413 public class SocketConnectionStateChangedEventArgs : EventArgs
415 private BluetoothError _result;
416 private BluetoothSocketState _state;
417 private SocketConnection _connection;
419 internal SocketConnectionStateChangedEventArgs(BluetoothError result, BluetoothSocketState state, SocketConnection connection)
423 _connection = connection;
427 /// The BluetoothError result.
429 public BluetoothError Result
438 /// The socket state.
440 public BluetoothSocketState State
449 /// The socket connection.
451 public SocketConnection Connection
460 public class AcceptStateChangedEventArgs : EventArgs
462 private BluetoothError _result;
463 private BluetoothSocketState _state;
464 private SocketConnection _connection;
465 private IBluetoothServerSocket _server;
467 internal AcceptStateChangedEventArgs(BluetoothError result, BluetoothSocketState state, SocketConnection connection, BluetoothSocket server)
471 _connection = connection;
472 _server = (IBluetoothServerSocket)server;
476 /// The BluetoothError result.
478 public BluetoothError Result
487 /// The socket state.
489 public BluetoothSocketState State
498 /// The socket connection.
500 public SocketConnection Connection
509 /// The server socket instance.
511 public IBluetoothServerSocket Server
521 /// An extended EventArgs class which contains the connection state,remote address and the type of audio profile.
523 public class AudioConnectionStateChangedEventArgs : EventArgs
526 private bool _isConnected;
527 private string _address;
528 private BluetoothAudioProfileType _type;
530 internal AudioConnectionStateChangedEventArgs(int result, bool isConnected, string address, BluetoothAudioProfileType type)
534 _isConnected = isConnected;
550 /// A value indicating whether this instance is connected.
552 public bool IsConnected
563 public string Address
572 /// The type of the audio profile.
574 public BluetoothAudioProfileType ProfileType
584 /// An extended EventArgs class which contains the connection state and address of the remote Bluetooth device.
586 public class HidConnectionStateChangedEventArgs : EventArgs
589 private bool _isConnected;
590 private string _address;
592 internal HidConnectionStateChangedEventArgs(int result, bool isConnected, string address)
595 _isConnected = isConnected;
611 /// A value indicating whether this instance is connected.
613 public bool IsConnected
624 public string Address
634 /// An extended EventArgs class which contains the changed equalizer state.
636 public class EqualizerStateChangedEventArgs : EventArgs
638 private EqualizerState _state;
640 internal EqualizerStateChangedEventArgs(EqualizerState state)
646 /// The state of equalizer.
648 public EqualizerState State
658 /// An extended EventArgs class which contains the changed repeat mode.
660 public class RepeatModeChangedEventArgs : EventArgs
662 private RepeatMode _mode;
664 internal RepeatModeChangedEventArgs(RepeatMode mode)
672 public RepeatMode Mode
682 /// An extended EventArgs class which contains the changed shuffle mode.
684 public class ShuffleModeChangedeventArgs : EventArgs
686 private ShuffleMode _mode;
688 internal ShuffleModeChangedeventArgs(ShuffleMode mode)
694 /// The shuffle mode.
696 public ShuffleMode Mode
706 /// An extended EventArgs class which contains the changed scan mode.
708 public class ScanModeChangedEventArgs : EventArgs
710 private ScanMode _mode;
712 internal ScanModeChangedEventArgs(ScanMode mode)
730 /// An extended EventArgs class which contains the connection state and the remote device address.
732 public class TargetConnectionStateChangedEventArgs : EventArgs
734 private bool _isConnected;
735 private string _address;
737 internal TargetConnectionStateChangedEventArgs(bool isConnected, string address)
739 _isConnected = isConnected;
744 /// A value indicating whether this instance is connected.
746 public bool IsConnected
757 public string Address
767 /// An extended EventArgs class which contains changed Bluetooth LE advertising state changed information.
769 public class AdvertisingStateChangedEventArgs : EventArgs
771 private BluetoothLeAdvertisingState _state;
773 private IntPtr _advertiserHandle;
775 //TODO : Add conversion code from IntPtr to BluetoothLeAdvertiser class later
776 internal AdvertisingStateChangedEventArgs(int result, IntPtr advertiserHandle,
777 BluetoothLeAdvertisingState state)
780 _advertiserHandle = advertiserHandle;
796 /// The advertiser handle.
798 public IntPtr AdvertiserHandle
802 return _advertiserHandle;
807 /// The Le advertising state.
809 public BluetoothLeAdvertisingState State
819 /// An extended EventArgs class which contains changed Bluetooth LE scan result information.
821 public class AdapterLeScanResultChangedEventArgs : EventArgs
823 private BluetoothLeDevice _deviceData;
824 private BluetoothError _result;
826 internal AdapterLeScanResultChangedEventArgs(BluetoothError result, BluetoothLeDevice deviceData)
828 _deviceData = deviceData;
835 public BluetoothError Result
844 /// The Le device data.
846 public BluetoothLeDevice DeviceData
856 /// An extended EventArgs class which contains changed Bluetooth LE GATT connection state.
858 public class GattConnectionStateChangedEventArgs : EventArgs
860 private bool _isConnected;
862 private string _remoteAddress;
864 internal GattConnectionStateChangedEventArgs(int result, bool connected, string remoteAddress)
866 _isConnected = connected;
868 _remoteAddress = remoteAddress;
883 /// A value indicating whether this instance is connected.
885 public bool IsConnected
894 /// The remote address.
896 public string RemoteAddress
900 return _remoteAddress;
906 /// An extended EventArgs class which contains changed attribute value.
908 public class ValueChangedEventArgs : EventArgs
910 internal ValueChangedEventArgs(byte[] value)
916 /// The attribute value.
918 public byte[] Value { get; }
922 /// An extended EventArgs class which contains read value request data.
924 public class ReadRequestedEventArgs : EventArgs
926 internal ReadRequestedEventArgs(BluetoothGattServer server, string clientAddress, int requestId, int offset)
929 ClientAddress = clientAddress;
930 RequestId = requestId;
935 /// The gatt server instance.
937 public BluetoothGattServer Server { get; }
939 /// The client address.
941 public string ClientAddress { get; }
943 /// The request identifier.
945 public int RequestId { get; }
949 public int Offset { get; }
953 /// An extended EventArgs class which contains read value request data.
955 public class WriteRequestedEventArgs : EventArgs
957 internal WriteRequestedEventArgs(BluetoothGattServer server, string clientAddress, int requestId, byte[] value, int offset, bool response_needed)
960 ClientAddress = clientAddress;
961 RequestId = requestId;
964 Response_needed = response_needed;
968 /// The gatt server instance.
970 public BluetoothGattServer Server { get; }
972 /// The client address.
974 public string ClientAddress { get; }
976 /// The request identifier.
978 public int RequestId { get; }
982 public byte[] Value { get; }
986 public int Offset { get; }
988 /// Indicates whether a response is required by the remote device.
990 public bool Response_needed { get; }
994 /// An extended EventArgs class which contains client preference to enables or disables the Notification/Indication.
996 public class NotificationStateChangedEventArg : EventArgs
998 internal NotificationStateChangedEventArg(BluetoothGattServer server, bool value)
1005 /// The gatt server instance.
1007 public BluetoothGattServer Server { get; }
1009 /// A value indicating whether the notification is enabled
1011 public bool Value { get; }
1015 /// An extended EventArgs class which contains read value request data.
1017 public class NotificationSentEventArg : EventArgs
1019 internal NotificationSentEventArg(BluetoothGattServer server, string clientAddress, int result, bool completed)
1022 ClientAddress = clientAddress;
1024 Completed = completed;
1028 /// The gatt server instance.
1030 public BluetoothGattServer Server { get; }
1032 /// The client address.
1034 public string ClientAddress { get; }
1038 public int Result { get; }
1040 /// Gets a value indicating whether notification sent is completed.
1042 public bool Completed { get; }