Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Network.Bluetooth / Tizen.Network.Bluetooth / BluetoothData.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.Runtime.InteropServices;
19 using System.Collections.Generic;
20 using System.Collections.Concurrent;
21 using System.Collections.ObjectModel;
22 using System.Collections.Specialized;
23
24 namespace Tizen.Network.Bluetooth
25 {
26     /// <summary>
27     /// This class is used to handle the device class types and the service.
28     /// </summary>
29     public class BluetoothClass
30     {
31         internal BluetoothMajorDeviceClassType MajorType;
32         internal BluetoothMinorDeviceClassType MinorType;
33         internal int Mask;
34
35         internal BluetoothClass()
36         {
37         }
38
39         /// <summary>
40         /// The type of the major device class.
41         /// </summary>
42         public BluetoothMajorDeviceClassType MajorDeviceClassType
43         {
44             get
45             {
46                 return MajorType;
47             }
48         }
49         /// <summary>
50         /// The type of the minor device class.
51         /// </summary>
52         public BluetoothMinorDeviceClassType MinorDeviceClassType
53         {
54             get
55             {
56                 return MinorType;
57             }
58         }
59         /// <summary>
60         /// The major service class mask.
61         /// </summary>
62         public int MajorServiceClassMask
63         {
64             get
65             {
66                 return Mask;
67             }
68         }
69     }
70
71     /// <summary>
72     /// This class contains the information of the Bluetooth OOB data.
73     /// </summary>
74     public class BluetoothOobData
75     {
76         /// <summary>
77         /// The default constructor. Initializes an object of the BluetoothOobData.
78         /// </summary>
79         public BluetoothOobData()
80         {
81         }
82
83         /// <summary>
84         /// The hash value.
85         /// </summary>
86         public byte[] HashValue
87         {
88             get;
89             set;
90         }
91         /// <summary>
92         /// The randomizer value.
93         /// </summary>
94         public byte[] RandomizerValue
95         {
96             get;
97             set;
98         }
99     }
100
101     /// <summary>
102     /// This class contains the information of the Bluetooth device SDP data.
103     /// </summary>
104     public class BluetoothDeviceSdpData
105     {
106         internal string Address;
107         internal Collection<string> Uuid;
108
109         internal BluetoothDeviceSdpData()
110         {
111         }
112
113         /// <summary>
114         /// The device address.
115         /// </summary>
116         public string DeviceAddress
117         {
118             get
119             {
120                 return Address;
121             }
122         }
123         /// <summary>
124         /// The service UUID.
125         /// </summary>
126         public IEnumerable<string> ServiceUuid
127         {
128             get
129             {
130                 return Uuid;
131             }
132         }
133     }
134
135     /// <summary>
136     /// This class contains the information of the Bluetooth device connection data.
137     /// </summary>
138     public class BluetoothDeviceConnectionData
139     {
140         internal string RemoteAddress;
141         internal BluetoothConnectionLinkType Link;
142         internal BluetoothDisconnectReason Reason;
143
144         internal BluetoothDeviceConnectionData()
145         {
146         }
147
148         /// <summary>
149         /// The device address.
150         /// </summary>
151         public string Address
152         {
153             get
154             {
155                 return RemoteAddress;
156             }
157         }
158         /// <summary>
159         /// The type of the connection link.
160         /// </summary>
161         public BluetoothConnectionLinkType LinkType
162         {
163             get
164             {
165                 return Link;
166             }
167         }
168         /// <summary>
169         /// The disconnect reason.
170         /// </summary>
171         public BluetoothDisconnectReason DisconnectReason
172         {
173             get
174             {
175                 return Reason;
176             }
177         }
178     }
179
180     /// <summary>
181     /// This class contains the information of the track data.
182     /// </summary>
183     public class Track
184     {
185         /// <summary>
186         /// The default constructor. Initializes an object of the track.
187         /// </summary>
188         public Track()
189         {
190         }
191
192         /// <summary>
193         /// The title of the track.
194         /// </summary>
195         public string Title
196         {
197             get;
198             set;
199         }
200         /// <summary>
201         /// The artist of the track.
202         /// </summary>
203         public string Artist
204         {
205             get;
206             set;
207         }
208         /// <summary>
209         /// The album of the track.
210         /// </summary>
211         public string Album
212         {
213             get;
214             set;
215         }
216         /// <summary>
217         /// The genre of the track.
218         /// </summary>
219         public string Genre
220         {
221             get;
222             set;
223         }
224         /// <summary>
225         /// The track number.
226         /// </summary>
227         public uint TrackNum
228         {
229             get;
230             set;
231         }
232         /// <summary>
233         /// The number of all tracks.
234         /// </summary>
235         public uint TotalTracks
236         {
237             get;
238             set;
239         }
240         /// <summary>
241         /// The duration of the track in milliseconds.
242         /// </summary>
243         public uint Duration
244         {
245             get;
246             set;
247         }
248     }
249
250     /// <summary>
251     /// This class contains the information of the manufacturer data.
252     /// </summary>
253     public class ManufacturerData
254     {
255         /// <summary>
256         /// The default Constructor. Initializes an object of the ManufacturerData.
257         /// </summary>
258         public ManufacturerData()
259         {
260         }
261
262         /// <summary>
263         /// The manufacturer ID.
264         /// </summary>
265         public int Id
266         {
267             get;
268             set;
269         }
270         /// <summary>
271         /// The length of the manufacturer data.
272         /// </summary>
273         public int DataLength
274         {
275             get;
276             set;
277         }
278         /// <summary>
279         /// The manufacturer data.
280         /// </summary>
281         public byte[] Data
282         {
283             get;
284             set;
285         }
286     }
287
288     internal class BluetoothLeScanData
289     {
290         internal string RemoteAddress
291         {
292             get;
293             set;
294         }
295         internal BluetoothLeDeviceAddressType AddressType
296         {
297             get;
298             set;
299         }
300         internal int Rssi
301         {
302             get;
303             set;
304         }
305         internal int AdvDataLength
306         {
307             get;
308             set;
309         }
310         internal byte[] AdvData
311         {
312             get;
313             set;
314         }
315         internal int ScanDataLength
316         {
317             get;
318             set;
319         }
320         internal byte[] ScanData
321         {
322             get;
323             set;
324         }
325     }
326
327     /// <summary>
328     /// This class contains the information of the Bluetooth service data.
329     /// </summary>
330     public class BluetoothServiceData
331     {
332         /// <summary>
333         /// The default constructor. Initializes an object of the BluetoothServiceData.
334         /// </summary>
335         public BluetoothServiceData()
336         {
337         }
338
339         /// <summary>
340         /// The UUID of the service.
341         /// </summary>
342         public string Uuid
343         {
344             get;
345             set;
346         }
347         /// <summary>
348         /// The data length of the service data.
349         /// </summary>
350         public int DataLength
351         {
352             get;
353             set;
354         }
355         /// <summary>
356         /// The service data.
357         /// </summary>
358         public byte[] Data
359         {
360             get;
361             set;
362         }
363     }
364
365     /// <summary>
366     /// This class contains the service data information.
367     /// </summary>
368     public class BluetoothLeServiceData
369     {
370         internal string Uuid;
371         internal byte[] Data;
372         internal int Length;
373
374         internal BluetoothLeServiceData()
375         {
376         }
377
378         /// <summary>
379         /// The Bluetooth LE service UUID.
380         /// </summary>
381         public string ServiceUuid
382         {
383             get
384             {
385                 return Uuid;
386             }
387         }
388         /// <summary>
389         /// The Bluetooth LE service data.
390         /// </summary>
391         public byte[] ServiceData
392         {
393             get
394             {
395                 return Data;
396             }
397         }
398         /// <summary>
399         /// The length of the service data.
400         /// </summary>
401         public int ServiceDataLength
402         {
403             get
404             {
405                 return Length;
406             }
407         }
408     }
409
410     /// <summary>
411     /// This class contains the information of the socket data.
412     /// </summary>
413     public class SocketData
414     {
415         internal string RecvData;
416         internal int Size;
417         internal int Fd;
418
419         internal SocketData()
420         {
421         }
422
423         /// <summary>
424         /// The socket FD.
425         /// </summary>
426         public int SocketFd
427         {
428             get
429             {
430                 return Fd;
431             }
432         }
433         /// <summary>
434         /// The length of the received data.
435         /// </summary>
436         public int DataSize
437         {
438             get
439             {
440                 return Size;
441             }
442         }
443         /// <summary>
444         /// The received data.
445         /// </summary>
446         public string Data
447         {
448             get
449             {
450                 return RecvData;
451             }
452         }
453     }
454
455     /// <summary>
456     /// This class contains the information of the socket connection.
457     /// </summary>
458     public class SocketConnection
459     {
460         internal string Uuid;
461         internal string RemoteAddress;
462         internal int Fd;
463
464         internal SocketConnection()
465         {
466         }
467
468         /// <summary>
469         /// The connected socket FD.
470         /// </summary>
471         public int SocketFd
472         {
473             get
474             {
475                 return Fd;
476             }
477         }
478         /// <summary>
479         /// The remote device address.
480         /// </summary>
481         public string Address
482         {
483             get
484             {
485                 return RemoteAddress;
486             }
487         }
488         /// <summary>
489         /// The service UUID.
490         /// </summary>
491         public string ServiceUuid
492         {
493             get
494             {
495                 return Uuid;
496             }
497         }
498     }
499 }