| 19 | } |
| 20 | |
| 21 | void ReadFunc(const Handle& handle, base::CBuffer* data, uint32_t len, uint32_t error) { |
| 22 | if (error != CEC_SUCCESS) { |
| 23 | std::cout << "something err while read : " << error << std::endl; |
| 24 | |
| 25 | } else { |
| 26 | char msg_buf[__buf_len] = {0}; |
| 27 | int need_len = 0; |
| 28 | int find_len = strlen(__buf_spilt); |
| 29 | // get recv data to send back. |
| 30 | int size = data->ReadUntil(msg_buf, __buf_len, __buf_spilt, find_len, need_len); |
| 31 | handle->Write(msg_buf, size); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | void ConnectFunc(const Handle& handle, uint32_t error) { |
| 36 | if (error != CEC_SUCCESS) { |