| 172 | } |
| 173 | |
| 174 | arm::pipe::Packet BasePipeServer::ReceivePacket() |
| 175 | { |
| 176 | uint32_t header[2]; |
| 177 | if (!ReadHeader(header)) |
| 178 | { |
| 179 | return arm::pipe::Packet(); |
| 180 | } |
| 181 | // Read data_length bytes from the socket. |
| 182 | std::unique_ptr<unsigned char[]> uniquePacketData = std::make_unique<unsigned char[]>(header[1]); |
| 183 | unsigned char* packetData = reinterpret_cast<unsigned char*>(uniquePacketData.get()); |
| 184 | |
| 185 | if (!ReadFromSocket(packetData, header[1])) |
| 186 | { |
| 187 | return arm::pipe::Packet(); |
| 188 | } |
| 189 | |
| 190 | EchoPacket(PacketDirection::ReceivedData, packetData, header[1]); |
| 191 | |
| 192 | // Construct received packet |
| 193 | arm::pipe::Packet packetRx = arm::pipe::Packet(header[0], header[1], uniquePacketData); |
| 194 | if (m_EchoPackets) |
| 195 | { |
| 196 | std::cout << "Processing packet ID= " << packetRx.GetPacketId() << " Length=" << packetRx.GetLength() |
| 197 | << std::endl; |
| 198 | } |
| 199 | |
| 200 | return packetRx; |
| 201 | } |
| 202 | |
| 203 | bool BasePipeServer::SendPacket(uint32_t packetFamily, uint32_t packetId, const uint8_t* data, uint32_t dataLength) |
| 204 | { |
nothing calls this directly
no test coverage detected