Tipro API
Communicate with Tipro devices
TiproBus.h
1 // TiproBus.h: interface for the TiproBus class.
2 //
4 
5 #if !defined(AFX_TIPROBUS_H__AF558BF3_3AAE_4547_975B_94FF6244BC91__INCLUDED_)
6 #define AFX_TIPROBUS_H__AF558BF3_3AAE_4547_975B_94FF6244BC91__INCLUDED_
7 
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
11 
12 /****************************************************************************/
13 /* MODULE ID DEFINITIONS */
14 /****************************************************************************/
15 
16 #define LCD_MIN_ID 0x10 /* First LCD module ID */
17 #define LCD_MAX_ID 0x1F /* Last LCD module ID */
18 #define ICCR_LCD_MATRIX_ID 0x08 /* ICCR + Matrix + LCD module ID */
19 #define KEYLOCK_ID 0x04 /* Keylock module ID */
20 #define MCR_OLD_T12 0x01 /* MCR Track 1+2, Old version */
21 #define MCR_ATMEL_T23 0x02 /* MCR Atmel Tracks 2+3 */
22 #define MCR_ATMEL_T123 0x03 /* MCR Atmel Tracks 1+2+3 */
23 #define MCR_ATMEL_T1 0x0A /* MCR Atmel Track 1 */
24 #define MCR_ATMEL_T12 0x0B /* MCR Atmel Tracks 1 + 2 */
25 #define IBUTTON_ID 0x0C /* iButton */
26 #define BCR_INPUT_ID 0x0F /* BCR input */
27 #define BCR_SLOT_ID 0x09 /* BCR slot reader */
28 
29 #define KEYLOCK_ABS_ID 0x34 /* PRO30 keylock */
30 #define MCR_ABS_ID 0x33 /* PRO30 MCR */
31 
32 #define LCD_KB50_ID 0x44 /* KB50 LCD module with DDD part */
33 
34 #define BF3_ID 0x49 /* BeFree V3 */
35 #define PAO_ID 0x4A /* Powered Add-On */
36 
37 /* BF10 IDs */
38 #define BF10_ID 0x20 /* BeFree10 with goosneck microphone */
39 #define BF10_NOMIC_ID 0x21 /* BeFree10 without goosneck microphone */
40 #define BF10_ECHO_ID 0x22 /* BeFree10 with echo cancelation hardware */
41 #define BF10_SBX_ID 0x2E /* Speakerbox built in BeFree10 */
42 
43 /* BF10 v2 IDs tomaz20170512 */
44 #define BF10_V2_ID 0x27 /* BeFree10 with goosneck microphone version2 */
45 #define BF10_NOMIC_V2_ID 0x29 /* BeFree10 without goosneck microphone version2 */
46 #define BF10_ECHO_V2_ID 0x2B /* BeFree10 with echo cancelation hardware version2 */
47 /* Task #138 */
48 #define BF10_SBX_V2_ID 0x5A /* Speakerbox built in BeFree10 with BF22 firmware */
49 
50 /* BF20 IDs tomaz20160511 */
51 /* Task#120 */
52 #define BF20_ID 0x24 /* BeFree20 with goosneck microphone */
53 #define BF20_NOMIC_ID 0x25 /* BeFree20 without goosneck microphone */
54 #define BF20_ECHO_ID 0x26 /* BeFree20 with echo cancelation hardware */
55 #define BF20_SBX_ID 0x2D /* Speakerbox built in BeFree20 */
56 
57 /* BF22 IDs tomaz20171110 */
58 #define BF22_ID 0x50 /* BeFree22 with goosneck microphone */
59 #define BF22_NOMIC_ID 0x51 /* BeFree22 without goosneck microphone */
60 #define BF22_ECHO_ID 0x52 /* BeFree22 with echo cancelation hardware */
61 #define BF22_SBX_ID BF20_SBX_ID /* Speakerbox built in BeFree22 */
62 #define BF22_LINEKEYS_ID 0x54 /* Linekeys built in BeFree22 */
63 
64 /* BF07 IDs */
65 /* TODO: We will implement new way of IDs for new projects that */
66 /* doesn't need to be backwards compatible. Task#150 */
67 /* Basic BF07 will support both IDs, its derivates only the new ones. */
68 #define BF07_ID 0x5B
69 #define BF07_DIALPAD_ID 0x5C
70 // extended (16b) IDs
71 #define BF_BASE_ID 0x0066 // triggers XID usage
72 #define BF07_XID 0x6601
73 #define BF07_NOMIC_XID 0x6603
74 #define BF07_DIALPAD_XID 0x6602
75 
76 
77 /* Speakerbox IDs */
78 #define SBX_SEN_ID 0xAB
79 #define SBX_USB_ID 0xAB
80 #define SBX_ANALOG_ID 0xAB
81 #define SBX_USB_NOMIC_ID 0xDB
82 #define SBX_ANALOG_NOMIC_ID 0xDB
83 #define SBX_VOLUME_CTRL_ID 0x10
84 #define SBX_104_ID 0x2C
85 
86 /* sbx with telephony */
87 #define SBX_USB_TEL_NMIC_ID 0x4F
88 #define SBX_USB_TEL_ID 0x2F
89 
90 #define CHAMELEON_ID 0xA3
91 #define HANDSET_ID 0xAD
92 
93 // new handsets
94 #define HANDSET_HUM_ID 0x46 /* HUM */
95 #define HANDSET_HUM_K_ID 0xFA /* HUM/HUA with dialpad */
96 #define HANDSET_HUM_T_ID 0x4D /* HUM/HUA with telephony */
97 #define HANDSET_HUM_TK_ID 0x4E /* HUM/HUA with telephony and dialpad */
98 #define HANDSET_HUM_5B_ID 0xF9 /* HUA-5B */
99 
100 #define TM_BASE_MATRIX_ID 0xC0
101 #define TM_BASE_LCD_ID 0xC1
102 #define TM_BASE_ICCR_ID 0xC2
103 #define TM_BASE_MCR_ID 0xC3
104 #define TM_BASE_KEYLOCK_ID 0xC4
105 #define TM_BASE_IBUTTON_ID 0xC5
106 #define TM_BASE_CHAM_ID 0xC6
107 #define TM_BASE_BCR_ID 0xC7
108 #define TM_BASE_ALARM_ID 0xC8 /* Alarm ID is used for audio modules */
109 
110 class TiproBus
111 {
112 public:
113  TiproBus();
114  virtual ~TiproBus();
115 
116  enum ETModuleType
117  {
118  mtUnknown,
119  mtMatrix,
120  mtLCD,
121  mtICCR,
122  mtMCR,
123  mtBCR,
124  mtKeylock,
125  mtIDPen,
126  mtIButton,
127  mtSpeakerbox,
128  mtSpeakerboxVol,
129  mtChameleon,
130  mtHandset,
131  mtBeFreeV3,
132  mtPoweredAddOn,
133  mtBF10,
134  mtBF10Speakerbox,
135  /* added BF20 tomaz20160511*/
136  /* Task #120 */
137  mtBF20,
138  mtBF20Speakerbox,
139  /* added BF22 tomaz20171108*/
140  mtBF22,
141  mtBF22Linekeys,
142  mtSpeakerbox104,
143  mtBF07,
144  mtBF07Dialpad
145  };
146 
147  enum ETError
148  {
149  errNone,
150  errNotInitialized,
151  errWrongParameters,
152  errUnkown,
153  errNonExistantModule
154  };
155 
156  // public methods / functions
157  // AddModuleInfo(const unsigned char nIndex,const unsigned char nID,const unsigned char nTmcID);
158  //ETError Initialize(const unsigned char* nID, const unsigned char* nTmcID, const int nModules);
159  ETError Initialize(const unsigned int* nID, const unsigned char* nTmcID, const int nModules);
160  ETModuleType GetModuleType(const unsigned char nIndex);
161  // address I2C_ADR_NONE(0x3F) means impossible/undefined address and is used to return error
162  unsigned char GetAddressFromType(const ETModuleType ModuleType, const unsigned char nIndex);
163  bool IsInitialized(void) { return bInitialized; };
164 
165  // extended command to provide compatibility between different module types
166  unsigned char GetAddressFromTypeEx(const unsigned char nIndex, const ETModuleType ModuleType, ...);
167 
168  // FW version information Task#96
169  ETError GetModuleVersionInfo(const unsigned char nIndex, unsigned char* nVerMajor, unsigned char* nVerMinor, unsigned char* nVerBuild);
170  //ETError Initialize(const unsigned char* nID, const unsigned char* nTmcID, const int nModules, const unsigned char* arVerMajor, const unsigned char* arVerMinor, const unsigned char* arVerBuild);
171  ETError Initialize(const unsigned int* nID, const unsigned char* nTmcID, const int nModules, const unsigned char* arVerMajor, const unsigned char* arVerMinor, const unsigned char* arVerBuild);
172 
173  // ID information task#103
174  //ETError GetModuleIDs (const unsigned char nIndex, unsigned char* nID, unsigned char* nTmcID);
175  ETError GetModuleIDs(const unsigned char nIndex, unsigned int* nID, unsigned char* nTmcID);
176 
177  // returns index of module from address, 0xFF is returned if address is not found
178  unsigned char GetModuleIndexFromAddress(const unsigned char nAddress);
179 
180 private:
181  unsigned char _nAddress[15];
182  unsigned char _nModuleNumber[15];
183  // Task#150 Extended ID "built" in the _nID, converted to unsigned int
184  // For example: 0x005B, old ID, 0x6601 new ID
185  // unsigned char _nID[15];
186  unsigned int _nID[15];
187  unsigned char _nTmcID[15];
188  ETModuleType _etModuleType[15];
189 
190  // FW version information Task#96
191  unsigned char _nVerMajor[15];
192  unsigned char _nVerMinor[15];
193  unsigned char _nVerBuild[15];
194 
195  bool bInitialized;
196 
197 
198  //ETModuleType GetModuleTypeFromIDs(const unsigned char nID, const unsigned char nTmcID);
199  ETModuleType GetModuleTypeFromIDs(const unsigned int nID, const unsigned char nTmcID);
200 
201 };
202 
203 #endif // !defined(AFX_TIPROBUS_H__AF558BF3_3AAE_4547_975B_94FF6244BC91__INCLUDED_)
Definition: TiproBus.h:110