summaryrefslogtreecommitdiff
path: root/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcEventArgs.cs
blob: 015b0df41df051435fdee71a409cd6de6f5f3ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
/*
 * 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.Nfc
{
    /// <summary>
    /// An extended EventArgs class which contains changed Nfc activation state.
    /// </summary>
    public class ActivationChangedEventArgs : EventArgs
    {
        private bool _activated = false;

        internal ActivationChangedEventArgs(bool activated)
        {
            _activated = activated;
        }

        /// <summary>
        /// The Nfc activation state.
        /// </summary>
        public bool Activated
        {
            get
            {
                return _activated;
            }
        }
    }

    /// <summary>
    /// An extended EventArgs class which contains changed Nfc tag discovered.
    /// </summary>
    public class TagDiscoveredEventArgs : EventArgs
    {
        private NfcDiscoveredType _type = NfcDiscoveredType.Detached;
        private NfcTag _tag;

        internal TagDiscoveredEventArgs(NfcDiscoveredType _type, IntPtr tagHandle)
        {
            _tag = new NfcTag(tagHandle);
        }

        /// <summary>
        /// The tag type.
        /// </summary>
        public NfcDiscoveredType Type
        {
            get
            {
                return _type;
            }
        }

        /// <summary>
        /// Tag object
        /// </summary>
        public NfcTag Tag
        {
            get
            {
                return _tag;
            }
        }
    }

    /// <summary>
    /// An extended EventArgs class which contains changed Nfc p2p target discovered.
    /// </summary>
    public class P2pTargetDiscoveredEventArgs : EventArgs
    {
        private NfcDiscoveredType _type = NfcDiscoveredType.Detached;
        private NfcP2p _p2pTarget;

        internal P2pTargetDiscoveredEventArgs(NfcDiscoveredType _type, IntPtr p2pTargetHandle)
        {
            _p2pTarget = new NfcP2p(p2pTargetHandle);
        }

        /// <summary>
        /// The p2p target type.
        /// </summary>
        public NfcDiscoveredType Type
        {
            get
            {
                return _type;
            }
        }

        /// <summary>
        /// P2p object
        /// </summary>
        public NfcP2p P2pTaget
        {
            get
            {
                return _p2pTarget;
            }
        }
    }

    /// <summary>
    /// An extended EventArgs class which contains changed Nfc ndef discovered.
    /// </summary>
    public class NdefMessageDiscoveredEventArgs : EventArgs
    {
        private NfcNdefMessage _ndef;

        internal NdefMessageDiscoveredEventArgs(IntPtr messageHandle)
        {
            _ndef = new NfcNdefMessage(messageHandle);
        }
        
        /// <summary>
        /// Tag object
        /// </summary>
        public NfcNdefMessage NdefMessage
        {
            get
            {
                return _ndef;
            }
        }
    }

    /// <summary>
    /// An extended EventArgs class which contains changed Secure element event.
    /// </summary>
    public class SecureElementEventArgs : EventArgs
    {
        private NfcSecureElementEvent _eventType = NfcSecureElementEvent.StartTransaction;

        internal SecureElementEventArgs(NfcSecureElementEvent eventType)
        {
            _eventType = eventType;
        }

        /// <summary>
        /// The Nfc secure element event.
        /// </summary>
        public NfcSecureElementEvent EventType
        {
            get
            {
                return _eventType;
            }
        }
    }

    /// <summary>
    /// An extended EventArgs class which contains changed Secure element trasaction event.
    /// </summary>
    public class SecureElementTranscationEventArgs : EventArgs
    {
        private NfcSecureElementType _secureElementType = NfcSecureElementType.Disable;
        byte[] _aid;
        byte[] _param;

        internal SecureElementTranscationEventArgs(NfcSecureElementType secureElementType, byte[] aid, byte[] param)
        {
            _secureElementType = secureElementType;
            _aid = aid;
            _param = param;
        }

        /// <summary>
        /// The Nfc secure element type.
        /// </summary>
        public NfcSecureElementType SecureElementType
        {
            get
            {
                return _secureElementType;
            }
        }
        /// <summary>
        /// The Nfc secure element aid.
        /// </summary>
        public byte[] ApplicationID
        {
            get
            {
                return _aid;
            }
        }
        /// <summary>
        /// The Nfc secure element param.
        /// </summary>
        public byte[] Param
        {
            get
            {
                return _param;
            }
        }
    }

    /// <summary>
    /// An extended EventArgs class which contains changed HCE(Host Card Emulation) event.
    /// </summary>
    public class HostCardEmulationEventArgs : EventArgs
    {
        private NfcSecureElement _se;
        private NfcHceEvent _hceEvent = NfcHceEvent.Deactivated;
        private byte[] _apdu;

        internal HostCardEmulationEventArgs(IntPtr seHandle, NfcHceEvent hcdEvent, byte[] apdu)
        {
            _se = new NfcSecureElement(seHandle);
            _hceEvent = hcdEvent;
            _apdu = apdu;
        }

        /// <summary>
        /// The Nfc secure element.
        /// </summary>
        public NfcSecureElement SecureElement
        {
            get
            {
                return _se;
            }
        }
        /// <summary>
        /// The Nfc hce event.
        /// </summary>
        public NfcHceEvent HcdEvent
        {
            get
            {
                return _hceEvent;
            }
        }
        /// <summary>
        /// The Nfc apdu(Application Protocol Data Unit)
        /// </summary>
        public byte[] Apdu
        {
            get
            {
                return _apdu;
            }
        }
    }

    /// <summary>
    /// An extended EventArgs class which contains changed HCE(Host Card Emulation) event.
    /// </summary>
    public class P2pDataReceivedEventArgs : EventArgs
    {
        private NfcP2p _p2pTarget;
        private NfcNdefMessage _ndefMessage;

        internal P2pDataReceivedEventArgs(IntPtr p2pHandle, IntPtr ndefHandle)
        {
            _p2pTarget = new NfcP2p(p2pHandle);
            _ndefMessage = new NfcNdefMessage(ndefHandle);
        }

        /// <summary>
        /// The Nfc p2p target.
        /// </summary>
        public NfcP2p P2pTarget
        {
            get
            {
                return _p2pTarget;
            }
        }
        /// <summary>
        /// The Nfc ndef message.
        /// </summary>
        public NfcNdefMessage NdefMessage
        {
            get
            {
                return _ndefMessage;
            }
        }
    }
}