VtoData EnhancedVto::CreateVtoData(bool aLocalVtoConnectionOpened, boost::uint8_t aChannelId) { VtoData vto(2 + MAGIC_BYTES_SIZE); vto.mpData[0] = aChannelId; vto.mpData[1] = aLocalVtoConnectionOpened ? 0 : 1; memcpy(vto.mpData + 2, EnhancedVto::MAGIC_BYTES, MAGIC_BYTES_SIZE); return vto; }
void VtoWriter::QueueVtoObject(const boost::uint8_t* apData, size_t aLength, boost::uint8_t aChannelId) { /* * Create a new VtoData instance, set the event data associated * with it, and then push the object onto the transmission queue. */ VtoData vto(apData, aLength); VtoEvent evt(vto, PC_CLASS_1, aChannelId); this->mQueue.push_back(evt); }
void Slave::HandleWriteVto(HeaderReadIterator& arHdr) { Transaction tr(mVtoReader); for (ObjectReadIterator obj = arHdr.BeginRead(); !obj.IsEnd(); ++obj) { size_t index = obj->Index(); if(index > std::numeric_limits<boost::uint8_t>::max()) { LOG_BLOCK(LEV_WARNING, "Ignoring VTO index that exceeds bit width of uint8_t: " << index); } else { /* * Pass the data to the vto reader */ boost::uint8_t channel = static_cast<boost::uint8_t>(index); VtoData vto(arHdr->GetVariation()); Group112Var0::Inst()->Read(*obj, arHdr->GetVariation(), vto.mpData); mVtoReader.Update(vto, channel); } } }