set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie -pie -std=c++1y")
-if(opencvlux_plugin)
- message(STATUS "OpenCV Lux plugin enabled")
-
-endif(opencvlux_plugin)
-
include (CMakeForceCompiler)
if (enable_icecc)
if(mBlocking)
{
- while(!mQueue.size())
+ if(!mQueue.size())
{
cond.wait(lock);
}
{
{
std::lock_guard<std::mutex> lock(mutex);
-
mQueue.insert(item);
}
if(mBlocking)
{
- cond.notify_one();
+ cond.notify_all();
}
}
NameValuePair<string> zone("zone", boost::lexical_cast<string>(obj.zone));
NameValuePair<string> four("time", boost::lexical_cast<string>(obj.time));
NameValuePair<string> five("sequence", boost::lexical_cast<string>(obj.sequence));
- NameValuePair<string> six("tripId", boost::lexical_cast<string>(shared->tripId));
+ NameValuePair<string> six("tripId", shared->tripId);
dict.push_back(one);
dict.push_back(two);
/// final flush of whatever is still in the queue:
shared->db->exec("BEGIN IMMEDIATE TRANSACTION");
- for(int i=0; i< insertList.size(); i++)
+ for(auto d : insertList)
{
- DictionaryList<string> d = insertList[i];
shared->db->insert(d);
}
shared->db->exec("END TRANSACTION");
{
VehicleProperty::Property property = value->name;
+ DebugOut() << "Received property change for " << property << endl;
+
if(!shared)
return;
bool quit;
- bool operator ==(const DBObject & other) const
+ bool operator == (const DBObject & other) const
{
return (key == other.key && source == other.source && zone == other.zone &&
value == other.value && sequence == other.sequence && time == other.time);
{
size_t operator()(const DBObject & x) const
{
- return x.key.length();
+ return x.key.length() * x.value.length() + x.time;
}
};
}
DebugOut()<<"setting enginespeed to: "<<engineSpeed<<endl;
vel.setValue(velocity);
+ vel.sequence++;
vel.priority = AbstractPropertyType::High;
es.setValue(engineSpeed);
+ es.sequence++;
es.priority = AbstractPropertyType::Low;
ac.setValue(accelerationX);
swa.setValue(steeringWheelAngle);
for(auto itr = values.begin(); itr != values.end(); itr++)
{
auto val = *itr;
- DebugOut(1)<<"Value from past: ("<<val->name<<"): "<<val->toString()<<" time: "<<val->timestamp<<endl;
+ DebugOut(1) <<"Value from past: (" << val->name << "): " << val->toString()
+ <<" time: " << val->timestamp << " sequence: " << val->sequence << endl;
}
delete reply;
find_package(Qt5Core REQUIRED)
if(Qt5Core_FOUND)
- message(STATUS "using Qt5")
-
set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} )
set(QT_LIBRARIES ${Qt5Core_LIBRARIES} )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
add_definitions(${Qt5Core_DEFINITIONS})
add_definitions(-DQT_NO_KEYWORDS)
-
endif(Qt5Core_FOUND)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Core REQUIRED)
if(Qt5Core_FOUND)
- message(STATUS "using Qt5")
-
set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} )
set(QT_LIBRARIES ${Qt5Core_LIBRARIES} )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/vehicle.js ${CMAKE_CURRENT_SOURCE_DIR}/test/vehicle.js)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/test.js ${CMAKE_CURRENT_SOURCE_DIR}/test/test.js)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/events.js ${CMAKE_CURRENT_SOURCE_DIR}/test/events.js)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protocol ${CMAKE_CURRENT_SOURCE_DIR}/protocol)
install(TARGETS websocketsource LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
{"type":"method", "name":"unsubscribe", "property":"EngineSpeed", "transactionid":"d293f670-f0b3-11e1-aff1-0800200c9a66"}
Get History request:
-{"type":"method","name":"getRange","data": {"property":"VehicleSpeed", "timeBegin":"1368825008.35948","timeEnd":"1368825018.35948","sequenceBegin":"-1","sequenceEnd":"-1"},"transactionid":"b07589ba-417c-4604-80c6-01c0dcbd524d"}
+{"type" : "method", "name" : "getRange", "data" : ["VehicleSpeed"], "timeBegin" : 1368825008.35948, "timeEnd" : 1368825018.35948, "sequenceBegin" : -1, "sequenceEnd" : -1, "transactionid" : "b07589ba-417c-4604-80c6-01c0dcbd524d"}
+
+Get History reply:
+{"data" : [{"name" : "EngineSpeed", "sequence":-1, "timestamp" : 143706.443, "value" : "13789"}], "name" : "getRanged", "transactionid" : "fe4a803e-d587-4fa0-bd5a-9cf689097d88", "type" : "methodReply"}
Set property request:
{ "type" : "method", "name" : "set", "data" : { "property" : "MachineGunTurretStatus", "value" : "true", "zone" : 0 }, "transactionid" : "4123123123" }
rangedRequest.timeEnd = end;
rangedRequest.sequenceBegin = seqstart;
rangedRequest.sequenceEnd = seqend;
+ rangedRequest.properties = properties;
- rangedRequest.completed = [socket,id](AsyncRangePropertyReply* reply)
+ rangedRequest.completed = [socket, id](AsyncRangePropertyReply* reply)
{
QVariantMap replyvar;
QVariantList list;
std::list<AbstractPropertyType*> values = reply->values;
- for(auto itr = values.begin(); itr != values.end(); itr++)
+ for(auto value : values)
{
QVariantMap obj;
- obj["value"]= (*itr)->toString().c_str();
- obj["timestamp"] = (*itr)->timestamp;
- obj["sequence"] = (*itr)->sequence;
+ obj["name"] = value->name.c_str();
+ obj["value"] = value->toString().c_str();
+ obj["timestamp"] = value->timestamp;
+ obj["sequence"] = value->sequence;
list.append(obj);
}
{
if(name == "getRanged")
{
- QVariantMap data = call["data"].toMap();
+ QVariant dataVariant = call["data"];
+
+ QVariantList data = dataVariant.toList();
PropertyList propertyList;
- propertyList.push_back(data["property"].toString().toStdString());
+ Q_FOREACH(QVariant v, data)
+ {
+ propertyList.push_back(v.toString().toStdString());
+ }
- double timeBegin = data["timeBegin"].toDouble();
- double timeEnd = data["timeEnd"].toDouble();
- double sequenceBegin = data["sequenceBegin"].toInt();
- double sequenceEnd = data["sequenceEnd"].toInt();
+ double timeBegin = call["timeBegin"].toDouble();
+ double timeEnd = call["timeEnd"].toDouble();
+ int sequenceBegin = call["sequenceBegin"].toInt();
+ int sequenceEnd = call["sequenceEnd"].toInt();
if ((timeBegin < 0 && timeEnd > 0) || (timeBegin > 0 && timeEnd < 0))
{
}
else
{
- sinkManager->addSingleShotRangedSink(wsi,propertyList,timeBegin,timeEnd,sequenceBegin,sequenceEnd,id);
+ sinkManager->addSingleShotRangedSink(wsi, propertyList, timeBegin, timeEnd, sequenceBegin, sequenceEnd, id);
}
}
else if (name == "get")
{
doc = QJsonDocument::fromJson(d);
DebugOut(7)<<d.data()<<endl;
- }
+ }
if(doc.isNull())
{
int sequence = obj["sequence"].toInt();
AbstractPropertyType* type = VehicleProperty::getPropertyTypeForPropertyNameValue(name, value);
+ if(!type)
+ {
+ DebugOut() << "TODO: support custom types here: " << endl;
+ continue;
+ }
type->timestamp = timestamp;
type->sequence = sequence;
replyvar["sequenceBegin"] = reply->sequenceBegin;
replyvar["sequenceEnd"] = reply->sequenceEnd;
-
QStringList properties;
for (auto itr = reply->properties.begin(); itr != reply->properties.end(); itr++)