23.06.2014 - PICodeParser, PICodeInfo, PIConnection, new binary "pip_cmg"
This commit is contained in:
@@ -53,7 +53,8 @@ PIProtocol::PIProtocol(const PIString & config, const PIString & name_, void * r
|
||||
dataSize = recDataSize;
|
||||
sendDataPtr = (uchar * )sendDataPtr_;
|
||||
sendDataSize = sendDataSize_;
|
||||
packet_ext->setPacketData(recHeaderPtr, recHeaderSize, recDataSize);
|
||||
packet_ext->setHeader(PIByteArray(recHeaderPtr, recHeaderSize));
|
||||
packet_ext->setPayloadSize(recDataSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +84,7 @@ PIProtocol::~PIProtocol() {
|
||||
|
||||
|
||||
void PIProtocol::init() {
|
||||
packet_ext = new PIPacketExtractor();
|
||||
packet_ext = new PIPacketExtractor(0, PIPacketExtractor::Header);
|
||||
packet_ext->setThreadedReadData(this);
|
||||
packet_ext->setThreadedReadSlot(receiveEvent);
|
||||
packet_ext->setHeaderCheckSlot(headerValidateEvent);
|
||||
@@ -94,6 +95,7 @@ void PIProtocol::init() {
|
||||
mp_owner = 0;
|
||||
net_diag = PIProtocol::Unknown;
|
||||
cur_pckt = 0;
|
||||
packets[0] = packets[1] = pckt_cnt = pckt_cnt_max = 0;
|
||||
diagTimer = 0;
|
||||
timeout_ = 3.f;
|
||||
sendTimer = new PITimer(sendEvent, this);
|
||||
@@ -259,11 +261,11 @@ void PIProtocol::init_sender(PIConfig::Entry & b, PIConfig::Entry & sb, const PI
|
||||
}
|
||||
if (history_write_send) {
|
||||
history_path_send = sb.getValue("historyFile", "./history_" + protName + "_send_" +
|
||||
date2string(currentDate(), "__dd_mm_yyyy_") +
|
||||
time2string(currentTime(), "_hh_mm_ss_")).value();
|
||||
PIDate::current().toString("__dd_mm_yyyy_") +
|
||||
PITime::current().toString("_hh_mm_ss_")).value();
|
||||
history_id_send = sb.getValue("historyID", 0, &ok);
|
||||
if (!ok) {
|
||||
history_id_send = protName.toByteArray().checksumCRC16() + 1;
|
||||
history_id_send = ushort(protName.toByteArray().checksumPlain32()) + 1;
|
||||
piCoutObj << "Warning: no sender history ID defined, write with ID = " << history_id_send;
|
||||
}
|
||||
history_file_send.open(history_path_send, PIIODevice::WriteOnly);
|
||||
@@ -432,11 +434,11 @@ void PIProtocol::init_receiver(PIConfig::Entry & b, PIConfig::Entry & rb, const
|
||||
}
|
||||
if (history_write_rec) {
|
||||
history_path_rec = rb.getValue("historyFile", "./history_" + protName + "_rec_" +
|
||||
date2string(currentDate(), "__dd_mm_yyyy_") +
|
||||
time2string(currentTime(), "_hh_mm_ss_")).value();
|
||||
PIDate::current().toString("__dd_mm_yyyy_") +
|
||||
PITime::current().toString("_hh_mm_ss_")).value();
|
||||
history_id_rec = rb.getValue("historyID", 0, &ok);
|
||||
if (!ok) {
|
||||
history_id_rec = protName.toByteArray().checksumCRC16();
|
||||
history_id_rec = ushort(protName.toByteArray().checksumPlain32());
|
||||
piCoutObj << "Warning: no receiver history ID defined, write with ID = " << history_id_rec;
|
||||
}
|
||||
history_file_rec.open(history_path_rec, PIIODevice::WriteOnly);
|
||||
|
||||
Reference in New Issue
Block a user