LTPS C++ API
CWg.h
1 
5 
6 #ifndef __CWG_H__
7 #define __CWG_H__
8 
9 #include <stdio.h>
10 #include <string.h>
11 #include <unistd.h>
12 
13 #include <dirent.h>
14 #include <stdlib.h>
15 #include <stdint.h>
16 
17 #define TWG_MAX_BUF 512
18 
22 typedef struct wg_data_T {
24  uint16_t blen;
26  uint8_t buff[ TWG_MAX_BUF/8];
27 } wg_data_t;
28 
29 
31 class CWg {
32 
33 private:
34 
35  void null_sock( void) { memset( this->sock, 0, 64); }
36 
37 protected:
38 
39  int f_rw;
40  char sock[ 64];
41 
42  int x_open( const char *_sock, const char *_what, int _flags);
43  void x_close( void) {
44  this->null_sock();
45  if ( this->f_rw) close( this->f_rw);
46  this->f_rw = -1; }
47 
48 // int find_sock( char *_sock);
49 
50 public:
51 
52  CWg( void) {
53  this->null_sock();
54  this->f_rw = 0; }
55  ~CWg( void) { this->x_close(); }
56 
61  int init( const char *_sock);
62 
64  inline char *cur_sock( void) { return( this->sock); }
65 
70  int mode_get( void);
74  int mode_set( uint8_t _mode);
75 
79  int out0_get( void);
82  int out0_set( uint8_t _val);
83 
87  int conr_get( void);
90  int conr_set( uint8_t _val);
91 
97  int R( wg_data_t &_buf);
98 
99 };
100 
101 #endif
int out0_set(uint8_t _val)
int R(wg_data_t &_buf)
Read Wiegand buffer After this function call Wiegand device buffer gets empty This call is non-blocki...
int mode_get(void)
Get/Set current Tibbit#08 mode.
int init(const char *_sock)
Open Wiegand device on socket _sock.
int mode_set(uint8_t _mode)
I2C bus name to # mapping structure.
int conr_get(void)
Get/Set value of 'clear on read' flag.
int out0_get(void)
Get/Set value of open collector pin.
char * cur_sock(void)
Get current socket name.
Definition: CWg.h:64
int conr_set(uint8_t _val)
Wiegand Tibbit#08 I/O class.
Definition: CWg.h:31