File: BEID_ReaderSet.cs

package info (click to toggle)
beid 3.5.2.dfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 147,240 kB
  • ctags: 34,507
  • sloc: cpp: 149,944; ansic: 41,577; java: 8,927; cs: 6,528; sh: 2,426; perl: 1,866; xml: 805; python: 463; makefile: 263; lex: 92
file content (228 lines) | stat: -rw-r--r-- 9,211 bytes parent folder | download
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
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.35
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace be.belgium.eid {

using System;
using System.Runtime.InteropServices;

/// <summary>
/// This is a singleton class that is the starting point to get all other objects.
/// You get an instance from the static instance() method (or using the define ReaderSet).
/// Then you get a READER							(BEID_ReaderContext)
///		-> from this reader, you a CARD				(BEID_Card or derived class)
///			-> from this card, you get DOCUMENT		(BEID_XMLDoc or derived class)
///				-> ...
///</summary>
    public class BEID_ReaderSet : BEID_Object
    {
  private HandleRef swigCPtr;

  internal BEID_ReaderSet(IntPtr cPtr, bool cMemoryOwn) : base(beidlib_dotNetPINVOKE.BEID_ReaderSetUpcast(cPtr), cMemoryOwn) {
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(BEID_ReaderSet obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~BEID_ReaderSet() {
    Dispose();
  }

  public override void Dispose() {
    lock(this) {
      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
        swigCMemOwn = false;
        beidlib_dotNetPINVOKE.delete_BEID_ReaderSet(swigCPtr);
      }
      swigCPtr = new HandleRef(null, IntPtr.Zero);
      GC.SuppressFinalize(this);
      base.Dispose();
    }
  }

  public static BEID_ReaderSet instance() {
    BEID_ReaderSet ret = new BEID_ReaderSet(beidlib_dotNetPINVOKE.BEID_ReaderSet_instance(), false);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>Init the SDK (Optional).</summary>
  /// <param name="bManageTestCard">
  /// If true the applayer must ask if test cards are allowed (used for compatibility with old C API). 
  /// If false other applications (ex. gui) take that into their scope.
  /// </param>
  public static void initSDK(bool bManageTestCard)
  {
    beidlib_dotNetPINVOKE.BEID_ReaderSet_initSDK__SWIG_0(bManageTestCard);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
  }

  /// <summary>Init the SDK (Optional) without test card managment.</summary>
  public static void initSDK()
  {
    beidlib_dotNetPINVOKE.BEID_ReaderSet_initSDK__SWIG_1();
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
  }

  /// <summary>Release the SDK.</summary>
  public static void releaseSDK()
  {
    beidlib_dotNetPINVOKE.BEID_ReaderSet_releaseSDK();
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
  }

  /// <summary>Release the readers (Useful if readers had changed).</summary>
  /// <param name="bAllReference">
  /// If true all the invalid reference/pointer are destroyed.
  /// PUT THIS PARAMETER TO TRUE IS THREAD UNSAFE. 
  /// You have to be sure that you will not use any old reference/pointer after this release.
  /// </param>
  public void releaseReaders(bool bAllReference)
  {
    beidlib_dotNetPINVOKE.BEID_ReaderSet_releaseReaders__SWIG_0(swigCPtr, bAllReference);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
  }

  /// <summary>Release the readers (Useful if readers had changed).</summary>
  public void releaseReaders()
  {
    beidlib_dotNetPINVOKE.BEID_ReaderSet_releaseReaders__SWIG_1(swigCPtr);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
  }

  /// <summary>Return true if readers has been added or removed.</summary>
  public bool isReadersChanged()
  {
    bool ret = beidlib_dotNetPINVOKE.BEID_ReaderSet_isReadersChanged(swigCPtr);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>
  /// Get the list of the reader.
  /// Return an array of string.
  /// </summary>
  /// <param name="bForceRefresh">
  /// force the reconnection to the lower layer to see if reader list have changed
  /// </param>
  public string[] readerList(bool bForceRefresh)
  { 
	IntPtr p = beidlib_dotNetPINVOKE.BEID_ReaderSet_readerList__SWIG_0(swigCPtr, bForceRefresh);
	if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
	string[] rslt = beidlib_dotNetPINVOKE.custom_StringArrayResult;
	return rslt; 
  }

  /// <summary>
  /// Get the list of the reader.
  /// Return an array string.
  /// </summary>
  public string[] readerList() { 
	IntPtr p = beidlib_dotNetPINVOKE.BEID_ReaderSet_readerList__SWIG_1(swigCPtr);
	if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
	string[] rslt = beidlib_dotNetPINVOKE.custom_StringArrayResult;
	return rslt; 
  }

	/// <summary>
	/// Return the first readercontext with a card.
	/// </summary>
    /// <remarks>
	///		If no card is present, return the firs reader.
	///		If no reader exist, throw an exception BEID_ExNoReader.
    /// </remarks>
  public BEID_ReaderContext getReader() {
    BEID_ReaderContext ret = new BEID_ReaderContext(beidlib_dotNetPINVOKE.BEID_ReaderSet_getReader(swigCPtr), false);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>Get the reader by its name.</summary>
  public BEID_ReaderContext getReaderByName(string readerName)
  {
    BEID_ReaderContext ret = new BEID_ReaderContext(beidlib_dotNetPINVOKE.BEID_ReaderSet_getReaderByName(swigCPtr, readerName), false);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>
  /// Return the number of card readers connected to the computer.
  /// </summary>
  /// <param name="bForceRefresh">
  /// force the reconnection to the lower layer to see if reader list have changed.
  /// </param>
  public uint readerCount(bool bForceRefresh)
  {
    uint ret = beidlib_dotNetPINVOKE.BEID_ReaderSet_readerCount__SWIG_0(swigCPtr, bForceRefresh);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>
  /// Return the number of card readers connected to the computer.
  /// </summary>
  public uint readerCount()
  {
    uint ret = beidlib_dotNetPINVOKE.BEID_ReaderSet_readerCount__SWIG_1(swigCPtr);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>
  /// Get the name of the reader by its Index.
  /// </summary>
  /// <remarks>
  /// Throw BEID_ExParamRange exception if the index is out of range.
  /// </remarks>
  public string getReaderName(uint ulIndex) {
    string ret = beidlib_dotNetPINVOKE.BEID_ReaderSet_getReaderName(swigCPtr, ulIndex);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>
  /// Get the reader by its Index.
  /// </summary>
  /// <remarks>
  /// Throw BEID_ExParamRange exception if the index is out of range.
  /// </remarks>
  public BEID_ReaderContext getReaderByNum(uint ulIndex)
  {
    BEID_ReaderContext ret = new BEID_ReaderContext(beidlib_dotNetPINVOKE.BEID_ReaderSet_getReaderByNum(swigCPtr, ulIndex), false);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>
  /// Return the reader containing the card with this SN.
  /// </summary>
  /// <remarks>
  /// If no card with this SN is found, throw an exception BEID_ExParamRange.
  /// </remarks>
  public BEID_ReaderContext getReaderByCardSerialNumber(string cardSerialNumber)
  {
    BEID_ReaderContext ret = new BEID_ReaderContext(beidlib_dotNetPINVOKE.BEID_ReaderSet_getReaderByCardSerialNumber(swigCPtr, cardSerialNumber), false);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>
  /// Flush the cached files.
  /// Return if any files were flushed (T/F).
  /// </summary>
  public bool flushCache() {
    bool ret = beidlib_dotNetPINVOKE.BEID_ReaderSet_flushCache(swigCPtr);
    if (beidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw beidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}