| 210 | |
| 211 | |
| 212 | void *CExynosCECAdapterCommunication::Process(void) |
| 213 | { |
| 214 | uint8_t buffer[CEC_MAX_FRAME_SIZE]; |
| 215 | uint32_t size; |
| 216 | fd_set rfds; |
| 217 | cec_logical_address initiator, destination; |
| 218 | |
| 219 | if (!IsOpen()) |
| 220 | return 0; |
| 221 | |
| 222 | FD_ZERO(&rfds); |
| 223 | FD_SET(m_fd, &rfds); |
| 224 | |
| 225 | while (!IsStopped()) |
| 226 | { |
| 227 | if (select(m_fd + 1, &rfds, NULL, NULL, NULL) >= 0 ) |
| 228 | { |
| 229 | size = read(m_fd, buffer, CEC_MAX_FRAME_SIZE); |
| 230 | |
| 231 | if (size > 0) |
| 232 | { |
| 233 | initiator = cec_logical_address(buffer[0] >> 4); |
| 234 | destination = cec_logical_address(buffer[0] & 0x0f); |
| 235 | |
| 236 | cec_command cmd; |
| 237 | |
| 238 | cec_command::Format( |
| 239 | cmd, initiator, destination, |
| 240 | ( size > 1 ) ? cec_opcode(buffer[1]) : CEC_OPCODE_NONE); |
| 241 | |
| 242 | for( uint8_t i = 2; i < size; i++ ) |
| 243 | cmd.parameters.PushBack(buffer[i]); |
| 244 | |
| 245 | if (!IsStopped()) |
| 246 | m_callback->OnCommandReceived(cmd); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | } |
| 251 | |
| 252 | return 0; |
| 253 | } |
| 254 | |
| 255 | #endif // HAVE_EXYNOS_API |
nothing calls this directly
no test coverage detected