bool YModem::Packet::Send(SPort &port, Id pkt_num) const { bool res = SendScalar(port, (uint8_t)_type); if (_data == 0 || _type != kSTX) return res; Crc crc(Crc::kZeros); const Crc::Value kCrcVal = crc.Compute(_data, _data_sz); const Id kInvPktNum = 255 - pkt_num; res = res && SendScalar(port, (uint8_t)pkt_num); res = res && SendScalar(port, (uint8_t)kInvPktNum); res = res && SendArray (port, _data, _data_sz); res = res && SendScalar(port, kCrcVal); return res; }
//______________________________________________________________________________ void TCommunicator::SendSerialize(int dest, int tag, Char_t *data, Int_t size) { //util function to send serialized data from TObject, send firts the size of array //and after the array with serialized data SendScalar(dest, tag, size); SendArray(dest, tag, data, size); }