Tipro API
Communicate with Tipro devices
BF07_IntFn.h
1 #pragma once
2 
3 // BF07_IntFn.h :
5 
6 
8 // FW documentation
9 
10 /* SBX, BF10, BF20, BF07 common commands */
11 /* MID_MSGT_XXX_SBX_LED_CTRL= 0x00 / * LED control (WR/RD) */ /* 0xF0 */
12 /* MID_MSGT_SBX_MIC_SEL= 0x01 / * MIC selector (WR/RD) */ /* 0xF0 */
13 /* MID_MSGT_XXX_SBX_MIC_ATT= 0x02 / * MIC attenuation (WR/RD) */ /* 0xF0, 0x00 */
14 /* MID_MSGT_XXX_SBX_MIC_COMP= 0x03 / * MIC compression (WR/RD) */ /* 0xF0 */
15 /* MID_MSGT_XXX_SBX_MIC_THRS= 0x04 / * MIC noise threshold (WR/RD) */ /* 0xF0 */
16 /* MID_MSGT_SBX_MONO_SPK_SEL= 0x05 / * mono SPK selector (WR/RD) */ /* 0xF0 */
17 /* MID_MSGT_XXX_SBX_STEREO_SEL= 0x06 / * stereo selector (WR/RD) */ /* 0xF0, 0x00 */
18 /* MID_MSGT_SBX_MONO_SEL= 0x07 / * mono selector (WR/RD) */ /* 0xF0 */
19 /* MID_MSGT_SBX_MONO_SPK_AMP= 0x08 / * mono speaker-amp (WR/RD) */ /* 0xF0 */
20 /* MID_MSGT_XXX_SBX_MAN_XXX_SEL= 0x0A / * manual XXX selectors (WR/RD) */ /* 0xF0, 0x00 */
21 /* MID_MSGT_SBX_MONO_SIDETONE= 0x0B / * mono sidetone (WR/RD) */ /* 0xF0 */
22 /* MID_MSGT_SBX_HS_STATUS= 0x0C / * HS status (WR/RD) */ /* 0xF0 */
23 /* MID_MSGT_XXX_SBX_STEREO_SPK_MUTE= 0x0D / * stereo SPK mute (WR/RD) */ /* 0xF0, 0x00 */
24 /* MID_MSGT_XXX_SBX_KEY_STATUS= 0x0E / * SBX-keys status (RD) */ /* 0xF0, 0x00 */
25 /* MID_MSGT_XXX_SBX_HFREE_MIC_BUF_GAIN= 0x0F / * handsfree MIC-buffer gain */ /* 0xF0, 0x00 */
26 /* MID_MSGT_XXX_SBX_COM= 0x13 / * forward COM-data */ /* 0xF0 */
27 /* MID_MSGT_SBX_A_POWER= 0x15 / * ANALOG-POWER control */ /* 0xF0 */
28 /* MID_MSGT_SBX_TOUCH_DISABLE= 0x16 / * touch-disable control (WR/RD)*/ /* 0xF0 */
29 
30 
32 // BF07 internal definitions
33 
34 /* MID_MSGT_XXX_SBX_STEREO_SEL */
35 #define BF07_MID_MSGT_XXX_SBX_STEREO_SEL_PARAM_LEN 0x02 // (1 byte for CMD and 1 byte for parameters)
36 #define BF07_MID_MSGT_XXX_SBX_STEREO_SEL_DEF_PARAMS {MID_MSGT_XXX_SBX_STEREO_SEL, 0x7F} // init value for array of parameters, all VOID
37 // command doesn't check for response buffer length, so to be future-proof we need to reserve a bit more space until the command is improved
38 #define BF07_MID_MSGT_XXX_SBX_STEREO_SEL_RESPONSE_LEN 0x03+0x7F // (1 byte for CMD and 2 bytes for parameters + 128 bytes just in case)
39 #define BF07_MID_MSGT_XXX_SBX_STEREO_SEL_PARAM_LEN_RESP 0x01 // Reading current/init parameters requires only command code to be sent
40 #define BF07_MID_MSGT_XXX_SBX_STEREO_SEL_DEF_PARAMS_RESP {MID_MSGT_XXX_SBX_STEREO_SEL}
41 
42 // showing microphone signal on VU meter
43 #define BF07_VU_MIC_VOID 0x3F
44 #define BF07_VU_MIC_MASK 0x03
45 
46 // VU meter scenario
47 #define BF07_VU_SPK_VOID 0x3F
48 #define BF07_VU_SPK_MASK 0x0C
49 
50 // Microphone optimal distance
51 #define BF07_MIC_PREAMP_VOID 0xFF
52 #define BF07_ECHO_ATT_OFFSET_VOID 0xFF
53 #define BF07_MIC_FLAG_SET_INIT 0x80
54 
55 // Echo control
56 #define BF07_EC_VOID 0x3F
57 #define BF07_EC_MASK 0x70 // also reading bit 6, echo detected?
58 
59 // Internal functions ( for key emulation )
60 #define INT_FN_MUTE_HF_KEY 0x01
61 #define INT_FN_MUTE_HS_KEY 0x02
62 #define INT_FN_HOOK_KEY 0x03
63 #define INT_FN_HF_OVER_HS_KEY 0x04
64 
65 // PTT LED controll - internally used
66 #define PTT_LED_VOID 0xFF
67 
68 
70 // BF07 internal functions
71 
72 int intFn_BF07_SetMicOnVUState(TiproHidDevice *device, int nAddress, int nState, bool bSetInit = false);
73 int intFn_BF07_GetMicOnVUState(TiproHidDevice *device, int nAddress, int *nState, int *nInitState = nullptr);
74 
75 int intFn_BF07_SetVUCScenario(TiproHidDevice *device, int nAddress, int nScenario, bool bSetInit = false);
76 int intFn_BF07_GetVUCScenario(TiproHidDevice *device, int nAddress, int *nScenario, int *nInitScenario = nullptr);
77 
78 int intFn_BF07_SetMicrophoneLevel(TiproHidDevice *device, int nAddress, int nLevel, int nDevice = BF07_DEVICE_HANDSFREE_HANDSET, bool bSetInit = false);
79 int intFn_BF07_GetMicrophoneLevel(TiproHidDevice *device, int nAddress, int *nLevel, int nDevice = BF07_DEVICE_HANDSFREE, int *nInitLevel = nullptr);
80 
81 int intFn_BF07_SetMicrophoneOptimalDistance(TiproHidDevice *device, int nAddress, int nDistance, int nDevice = BF07_DEVICE_HANDSFREE_HANDSET, bool bSetInit = false);
82 int intFn_BF07_GetMicrophoneOptimalDistance(TiproHidDevice *device, int nAddress, int *nDistance, int nDevice = BF07_DEVICE_HANDSFREE, int *nInitDistance = nullptr);
83 
84 int intFn_BF07_SetMicrophoneCompression(TiproHidDevice *device, int nAddress, int nCompression, int nDevice = BF07_DEVICE_HANDSFREE_HANDSET, bool bSetInit = false);
85 int intFn_BF07_GetMicrophoneCompression(TiproHidDevice *device, int nAddress, int *nCompression, int nDevice = BF07_DEVICE_HANDSFREE, int *nInitCompression = nullptr);
86 
87 int intFn_BF07_SetMicrophoneThreshold(TiproHidDevice *device, int nAddress, int nThreshold, int nDevice = BF07_DEVICE_HANDSFREE_HANDSET, bool bSetInit = false);
88 int intFn_BF07_GetMicrophoneThreshold(TiproHidDevice *device, int nAddress, int *nThreshold, int nDevice = BF07_DEVICE_HANDSFREE, int *nInitThreshold = nullptr);
89 
90 int intFn_BF07_SetEcho(TiproHidDevice *device, int nAddress, int nMode, bool bSetInit = false);
91 int intFn_BF07_GetEcho(TiproHidDevice *device, int nAddress, int *nMode, int *nInitMode = nullptr);
92 
93 int intFn_BF07_SetSidetone(TiproHidDevice *device, int nAddress, bool bOn, int nLevel = BF07_SIDETONE_ILLEGAL, bool bSetInit = false);
94 int intFn_BF07_SetSidetoneLevel(TiproHidDevice *device, int nAddress, int nLevel, bool bSetInit = false);
95 int intFn_BF07_GetSidetoneLevel(TiproHidDevice *device, int nAddress, int *nLevel, int *nInitLevel = nullptr);
96 
97 int intFn_BF07_TouchDisable(TiproHidDevice *device, int nAddress, bool bDisable=true);
98 
99 int intFn_BF07_EmulateKey(TiproHidDevice *device, int nAddress, int nKeyFn, bool bKeyPress=true);
100 int intFn_BF07_ReleaseEmulatedKeys(TiproHidDevice *device, int nAddress);
101 
102 int intFn_BF07_SetPTTLed(TiproHidDevice *device, int nAddress, int nMode, int nTBlinkA = 0, int nTBlinkB = 0, bool bSetInit = false);
103 int intFn_BF07_GetPTTLed(TiproHidDevice *device, int nAddress, int *nMode, int *nTBlinkA = nullptr, int *nTBlinkB = nullptr);
104 
105 /* TODO: Tasks 153, 155, 157 */
106 int intFn_BF07_SetHandsetSpeakerLevel(TiproHidDevice *device, int nAddress, int nLevel, bool bSetInit = false);
107 int intFn_BF07_GetHandsetSpeakerLevel(TiproHidDevice *device, int nAddress, int *nLevel, int *nInitLevel = nullptr);
108 int intFn_BF07_SetMonoSpeakerMode(TiproHidDevice *device, int nAddress, int nMode, bool bSetInit = false);
109 int intFn_BF07_GetMonoSpeakerMode(TiproHidDevice *device, int nAddress, int *nMode, int *nInitMode = nullptr);
110 
111 // Internal functions from FW documentation
112 #if 0
113 
114 // MID_MSGT_SBX_LED_CTRL 0x00, 0x00
115 // One simple command for "changing mode" of each LED
116 int intFn_BF07_SetLEDMode(TiproHidDevice *device, int nAddress, int nKey, int nMode);
117 int intFn_BF07_GetLEDMode(TiproHidDevice *device, int nAddress, int nKey, int *nMode);
118 // nMode =
119 #define BF07_KEYLED_MODE_OFF 0x00
120 #define BF07_KEYLED_MODE_ON 0x01
121 #define BF07_KEYLED_MODE_BLINK 0x02
122 #define BF07_KEYLED_MODE_BLINK_INV 0x03
123 // for hardware with both RED and GREEN additional modes are defined
124 // combination of both is currently not allowed (but prepared for future)
125 #define BF07_KEYLED_2_MODE_ON 0x10
126 #define BF07_KEYLED_2_MODE_BLINK 0x20
127 #define BF07_KEYLED_2_MODE_BLINK_INV 0x30
128 
129 // One command that can change all LEDs at once
130 int intFn_BF07_SetLEDStateEx(TiproHidDevice *device, int nAddress, int nMask, int nState, int nBlink);
131 int intFn_BF07_GetLEDStateEx(TiproHidDevice *device, int nAddress, int *nState, int *nBlink);
132 
133 // nMask, nState, nBlink:
134 #define BF07_KEYLED_01 0x0001
135 #define BF07_KEYLED_02 0x0002
136 #define BF07_KEYLED_03 0x0004
137 #define BF07_KEYLED_04 0x0008
138 #define BF07_KEYLED_05 0x0010
139 #define BF07_KEYLED_06 0x0020
140 #define BF07_KEYLED_PTT 0x0040
141 
142 #define BF07_KEYLED_2_01 0x0100
143 #define BF07_KEYLED_2_02 0x0200
144 #define BF07_KEYLED_2_03 0x0400
145 #define BF07_KEYLED_2_04 0x0800
146 #define BF07_KEYLED_2_05 0x1000
147 #define BF07_KEYLED_2_06 0x2000
148 
149 // Command for controlling PTT LED
150 int intFn_BF07_SetPTTLEDState(TiproHidDevice *device, int nAddress, int nMode);
151 int intFn_BF07_GetPTTLEDState(TiproHidDevice *device, int nAddress, int *nMode);
152 
153 // Commands for setting blinking rate
154 int intFn_HIDSetSbxLEDBlinkSpeed(TiproHidDevice *device, int nAddress, int nTBlinkA, int nTBlinkB);
155 int intFn_HIDGetSbxLEDBlinkSpeed(TiproHidDevice *device, int nAddress, int *nTBlinkA, int *nTBlinkB);
156 
157 // RFU: Commands for MIC, HS_STATUS LEDs
158 int intFn_BF07_SetMicLEDMode(TiproHidDevice *device, int nAddress, int nMode);
159 int intFn_BF07_GetMicLEDMode(TiproHidDevice *device, int nAddress, int *nMode);
160 int intFn_BF07_SetHSStatusLEDMode(TiproHidDevice *device, int nAddress, int nMode);
161 int intFn_BF07_GetHSStatusLEDMode(TiproHidDevice *device, int nAddress, int *nMode);
162 
163 #endif
Definition: TiproHidDevice.h:29