@@ -51,39 +51,34 @@ const map<enum cec_user_control_code, const char *> Cec::cecUserControlCodeName
51
51
// We store a global handle, so we can use g_cec->ToString(..) in certain cases. This is a bit of a HACK :(
52
52
static ICECAdapter * g_cec = NULL ;
53
53
54
- int cecLogMessage (void *cbParam, const cec_log_message message) {
54
+ void cecLogMessage (void *cbParam, const cec_log_message * message) {
55
55
try {
56
- return ((CecCallback*) cbParam)->onCecLogMessage (message);
56
+ ((CecCallback*) cbParam)->onCecLogMessage (* message);
57
57
} catch (...) {}
58
- return 0 ;
59
58
}
60
59
61
- int cecKeyPress (void *cbParam, const cec_keypress key) {
60
+ void cecKeyPress (void *cbParam, const cec_keypress * key) {
62
61
try {
63
- return ((CecCallback*) cbParam)->onCecKeyPress (key);
62
+ ((CecCallback*) cbParam)->onCecKeyPress (* key);
64
63
} catch (...) {}
65
- return 0 ;
66
64
}
67
65
68
- int cecCommand (void *cbParam, const cec_command command) {
66
+ void cecCommand (void *cbParam, const cec_command * command) {
69
67
try {
70
- return ((CecCallback*) cbParam)->onCecCommand (command);
68
+ ((CecCallback*) cbParam)->onCecCommand (* command);
71
69
} catch (...) {}
72
- return 0 ;
73
70
}
74
71
75
- int cecAlert (void *cbParam, const libcec_alert alert, const libcec_parameter param) {
72
+ void cecAlert (void *cbParam, const libcec_alert alert, const libcec_parameter param) {
76
73
try {
77
- return ((CecCallback*) cbParam)->onCecAlert (alert, param);
74
+ ((CecCallback*) cbParam)->onCecAlert (alert, param);
78
75
} catch (...) {}
79
- return 0 ;
80
76
}
81
77
82
- int cecConfigurationChanged (void *cbParam, const libcec_configuration configuration) {
78
+ void cecConfigurationChanged (void *cbParam, const libcec_configuration * configuration) {
83
79
try {
84
- return ((CecCallback*) cbParam)->onCecConfigurationChanged (configuration);
80
+ ((CecCallback*) cbParam)->onCecConfigurationChanged (* configuration);
85
81
} catch (...) {}
86
- return 0 ;
87
82
}
88
83
89
84
int cecMenuStateChanged (void *cbParam, const cec_menu_state menu_state) {
@@ -95,7 +90,7 @@ int cecMenuStateChanged(void *cbParam, const cec_menu_state menu_state) {
95
90
96
91
void cecSourceActivated (void *cbParam, const cec_logical_address address, const uint8_t val) {
97
92
try {
98
- return ((CecCallback*) cbParam)->onCecSourceActivated (address, val);
93
+ ((CecCallback*) cbParam)->onCecSourceActivated (address, val);
99
94
} catch (...) {}
100
95
}
101
96
@@ -142,13 +137,13 @@ Cec::Cec(const char * name, CecCallback * callback)
142
137
strncpy (config.strDeviceName , name, sizeof (config.strDeviceName ));
143
138
config.deviceTypes .Add (CEC_DEVICE_TYPE_RECORDING_DEVICE);
144
139
145
- callbacks.CBCecLogMessage = &::cecLogMessage;
146
- callbacks.CBCecKeyPress = &::cecKeyPress;
147
- callbacks.CBCecCommand = &::cecCommand;
148
- callbacks.CBCecConfigurationChanged = &::cecConfigurationChanged;
149
- callbacks.CBCecAlert = &::cecAlert;
150
- callbacks.CBCecMenuStateChanged = &::cecMenuStateChanged;
151
- callbacks.CBCecSourceActivated = &::cecSourceActivated;
140
+ callbacks.logMessage = &::cecLogMessage;
141
+ callbacks.keyPress = &::cecKeyPress;
142
+ callbacks.commandReceived = &::cecCommand;
143
+ callbacks.configurationChanged = &::cecConfigurationChanged;
144
+ callbacks.alert = &::cecAlert;
145
+ callbacks.menuStateChanged = &::cecMenuStateChanged;
146
+ callbacks.sourceActivated = &::cecSourceActivated;
152
147
153
148
config.callbackParam = callback;
154
149
config.callbacks = &callbacks;
@@ -178,9 +173,9 @@ void Cec::open(const std::string &name) {
178
173
init ();
179
174
180
175
// Search for adapters
181
- cec_adapter devices[MAX_CEC_PORTS];
176
+ cec_adapter_descriptor devices[MAX_CEC_PORTS];
182
177
183
- uint8_t ret = cec->FindAdapters (devices, MAX_CEC_PORTS, NULL );
178
+ uint8_t ret = cec->DetectAdapters (devices, MAX_CEC_PORTS);
184
179
if (ret < 0 ) {
185
180
throw std::runtime_error (" Error occurred searching for adapters" );
186
181
}
@@ -194,9 +189,9 @@ void Cec::open(const std::string &name) {
194
189
LOG4CPLUS_INFO (logger, " Looking for " << name);
195
190
for (id=0 ; id<ret; ++id)
196
191
{
197
- if ( name.compare (devices[id].path ) == 0 )
192
+ if ( name.compare (devices[id].strComPath ) == 0 )
198
193
break ;
199
- if ( name.compare (devices[id].comm ) == 0 )
194
+ if ( name.compare (devices[id].strComName ) == 0 )
200
195
break ;
201
196
}
202
197
if ( id == ret )
@@ -206,13 +201,13 @@ void Cec::open(const std::string &name) {
206
201
}
207
202
208
203
// Just use the first found
209
- LOG4CPLUS_INFO (logger, " Opening " << devices[id].path );
204
+ LOG4CPLUS_INFO (logger, " Opening " << devices[id].strComPath );
210
205
211
- if (!cec->Open (devices[id].comm )) {
206
+ if (!cec->Open (devices[id].strComName )) {
212
207
throw std::runtime_error (" Failed to open adapter" );
213
208
}
214
209
215
- LOG4CPLUS_INFO (logger, " Opened " << devices[id].path );
210
+ LOG4CPLUS_INFO (logger, " Opened " << devices[id].strComPath );
216
211
}
217
212
218
213
void Cec::close (bool makeInactive) {
@@ -253,11 +248,11 @@ bool Cec::ping() {
253
248
* This will close any open device!
254
249
*/
255
250
ostream & Cec::listDevices (ostream & out) {
256
- cec_adapter devices[MAX_CEC_PORTS];
251
+ cec_adapter_descriptor devices[MAX_CEC_PORTS];
257
252
258
253
init ();
259
254
260
- int8_t ret = cec->FindAdapters (devices, MAX_CEC_PORTS, NULL );
255
+ int8_t ret = cec->DetectAdapters (devices, MAX_CEC_PORTS);
261
256
if (ret < 0 ) {
262
257
LOG4CPLUS_ERROR (logger, " Error occurred searching for adapters" );
263
258
return out;
@@ -268,9 +263,9 @@ ostream & Cec::listDevices(ostream & out) {
268
263
}
269
264
270
265
for (int8_t i = 0 ; i < ret; i++) {
271
- out << " [" << (int ) i << " ] port:" << devices[i].comm << " path:" << devices[i].path << endl;
266
+ out << " [" << (int ) i << " ] port:" << devices[i].strComName << " path:" << devices[i].strComPath << endl;
272
267
273
- if (!cec->Open (devices[i].comm )) {
268
+ if (!cec->Open (devices[i].strComPath )) {
274
269
out << " \t Failed to open" << endl;
275
270
}
276
271
@@ -280,12 +275,12 @@ ostream & Cec::listDevices(ostream & out) {
280
275
cec_logical_address logical_addres = (cec_logical_address) j;
281
276
282
277
HDMI::physical_address physical_address (cec->GetDevicePhysicalAddress (logical_addres));
283
- cec_osd_name name = cec->GetDeviceOSDName (logical_addres);
278
+ std::string name = cec->GetDeviceOSDName (logical_addres);
284
279
cec_vendor_id vendor = (cec_vendor_id) cec->GetDeviceVendorId (logical_addres);
285
280
286
281
out << " \t " << cec->ToString (logical_addres)
287
282
<< " @ 0x" << hex << physical_address
288
- << " " << name. name << " (" << cec->ToString (vendor) << " )"
283
+ << " " << name << " (" << cec->ToString (vendor) << " )"
289
284
<< endl;
290
285
}
291
286
}
0 commit comments