| 238 | } |
| 239 | |
| 240 | void *CIMXCECAdapterCommunication::Process(void) |
| 241 | { |
| 242 | hdmi_cec_event event; |
| 243 | int ret; |
| 244 | |
| 245 | cec_logical_address initiator, destination; |
| 246 | |
| 247 | while (!IsStopped()) |
| 248 | { |
| 249 | ret = m_dev->Read((char *)&event, sizeof(event), 1000); |
| 250 | if (ret > 0) |
| 251 | { |
| 252 | |
| 253 | initiator = cec_logical_address(event.msg[0] >> 4); |
| 254 | destination = cec_logical_address(event.msg[0] & 0x0f); |
| 255 | |
| 256 | //LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: Read data : type : %d initiator %d dest %d", __func__, event.event_type, initiator, destination); |
| 257 | if (event.event_type == MESSAGE_TYPE_RECEIVE_SUCCESS) |
| 258 | /* Message received */ |
| 259 | { |
| 260 | cec_command cmd; |
| 261 | |
| 262 | cec_command::Format( |
| 263 | cmd, initiator, destination, |
| 264 | ( event.msg_len > 1 ) ? cec_opcode(event.msg[1]) : CEC_OPCODE_NONE); |
| 265 | |
| 266 | for( uint8_t i = 2; i < event.msg_len; i++ ) |
| 267 | cmd.parameters.PushBack(event.msg[i]); |
| 268 | |
| 269 | if (!IsStopped()) |
| 270 | m_callback->OnCommandReceived(cmd); |
| 271 | } |
| 272 | |
| 273 | if (event.event_type == MESSAGE_TYPE_CONNECTED) |
| 274 | /* HDMI has just been reconnected - Notify phy address*/ |
| 275 | { |
| 276 | uint16_t iNewAddress = GetPhysicalAddress(); |
| 277 | m_callback->HandlePhysicalAddressChanged(iNewAddress); |
| 278 | } |
| 279 | /* We are not interested in other events */ |
| 280 | } /*else { |
| 281 | LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: Read returned %d", __func__, ret); |
| 282 | }*/ |
| 283 | |
| 284 | } |
| 285 | |
| 286 | return 0; |
| 287 | } |
| 288 | |
| 289 | #endif // HAVE_IMX_API |
nothing calls this directly
no test coverage detected