set(PROJECT_NAME "automotive-message-broker")
set(PROJECT_PRETTY_NAME "Automotive Message Broker")
-set(PROJECT_SERIES "0.14")
-set(PROJECT_MAJOR_VERSION "0.13")
-set(PROJECT_MINOR_VERSION "900")
+set(PROJECT_SERIES "0.15")
+set(PROJECT_MAJOR_VERSION "0.14")
+set(PROJECT_MINOR_VERSION "800")
set(PROJECT_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}")
-set(PROJECT_CODENAME "74A")
-set(PROJECT_QUALITY "beta")
+set(PROJECT_CODENAME "")
+set(PROJECT_QUALITY "alpha")
add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
add_definitions(-DPROJECT_NAME="${PROJECT_PRETTY_NAME}")
# Automotive Message Broker Daemon {#ambd}
-Version 0.13.900
+Version 0.14.800
## Introduction
~~~~~~~~~~~~~{.json}
{
- "mainloop" : "/usr/lib/x86_64-linux-gnu/automotive-message-broker/qtmainloopplugin.so",
+ "mainloop" : "/usr/lib/i386-linux-gnu/automotive-message-broker/qtmainloopplugin.so",
"plugins" : "/etc/ambd/plugins.d"
}
~~~~~~~~~~~~~
Version: @PROJECT_SERIES@
## New features:
-- [DBus] some classes for exporting custom interfaces moved to plugins-common
-- [Bluemonkey plugin] support for creating custom dbus interfaces: bluemonkey.exportInterface()
-- [Bluemonkey plugin] dbus module supports creating dbus interfaces to system or session services and
- creating/exporting dbus objects
-- [ambctl] support for enabling disabling plugins
-- [ambd] support plugins.d - now plugin segments can be stuck in there and amb will try to load all plugins that
- are enabled. See the example segments: /etc/ambd/plugins.d/dbus, examplesink, examplesource
-- [xwalk] vehicle extension now dynamically exports all AMB supported objects
+- [AMBClient] c++ client and server library for interfacing with AMB over bluetooth, websockets, etc
## Changes:
-- Plugin create() method signature changed.
-- Removed AbstractSinkManager class
-- Removed deprecated dbus interfaces
-- Removed deprecated 'FooChanged' signal introspection description
-- Deprecated 'GetFoo' method. This doesn't contain much more information that cannot already be
- obtained through the Properties interface.
## Fixes:
-- [XWalk] Fixed misspelled 'diagnostics' interface
-- [DBus] Fixed misspelled 'Diagnostics' interface
-- [XWalk] Fixed Zone.equals() return type
# AMB Release Notes {#release_notes}
-Version: 0.14
+Version: 0.15
## New features:
-- [DBus] some classes for exporting custom interfaces moved to plugins-common
-- [Bluemonkey plugin] support for creating custom dbus interfaces: bluemonkey.exportInterface()
-- [Bluemonkey plugin] dbus module supports creating dbus interfaces to system or session services and
- creating/exporting dbus objects
-- [ambctl] support for enabling disabling plugins
-- [ambd] support plugins.d - now plugin segments can be stuck in there and amb will try to load all plugins that
- are enabled. See the example segments: /etc/ambd/plugins.d/dbus, examplesink, examplesource
-- [xwalk] vehicle extension now dynamically exports all AMB supported objects
+- [AMBClient] c++ client and server library for interfacing with AMB over bluetooth, websockets, etc
## Changes:
-- Plugin create() method signature changed.
-- Removed AbstractSinkManager class
-- Removed deprecated dbus interfaces
-- Removed deprecated 'FooChanged' signal introspection description
-- Deprecated 'GetFoo' method. This doesn't contain much more information that cannot already be
- obtained through the Properties interface.
## Fixes:
-- [XWalk] Fixed misspelled 'diagnostics' interface
-- [DBus] Fixed misspelled 'Diagnostics' interface
-- [XWalk] Fixed Zone.equals() return type
return v;
}
-
-
-void amb::findJson(const string &buffer, std::string::size_type beg, std::string::size_type &end)
-{
- if(end == 0)
- {
- beg = buffer.find("{", beg);
- }
- else
- {
- beg = buffer.find("{", beg+1);
- }
-
- if(beg != std::string::npos)
- findJson(buffer, beg+1, end);
-
- std::string::size_type tempEnd;
- if((tempEnd = buffer.find("}", end)) != string::npos)
- {
- end = tempEnd;
- return;
- }
-}
picojson::value propertyToJson(std::shared_ptr<AbstractPropertyType> property);
-void findJson(const std::string & buffer, std::string::size_type beg, std::string::size_type & end);
-
}
#endif
amb::AmbRemoteClient::AmbRemoteClient(AbstractIo *io)
:BaseJsonMessageReader(io), serverTimeOffset(0)
{
+ TimeSyncMessage timeSyncRequest;
+ send(timeSyncRequest);
}
void amb::AmbRemoteClient::list(amb::AmbRemoteClient::ListCallback cb)
}
}
+double amb::AmbRemoteClient::correctTimeFromServer(double serverTimestamp)
+{
+ return serverTimestamp - serverTimeOffset;
+}
+
void amb::AmbRemoteClient::hasJsonMessage(const picojson::value &json)
{
DebugOut(7) << "json: " << json.serialize() << endl;
mSetMethodCalls.erase(call->messageId);
}
}
- else if(BaseMessage::is<MethodReply<TimeSyncMessage>>(json))
- {
+ }
+ else if(BaseMessage::is<MethodReply<TimeSyncMessage>>(json))
+ {
+ DebugOut(7) << "Received time sync message" << endl;
+ MethodReply<TimeSyncMessage> reply;
+ reply.fromJson(json);
+ if(reply.methodSuccess)
+ {
+ serverTimeOffset = amb::Timestamp::instance()->epochTime() - reply.method()->serverTime;
+ }
+ else
+ {
+ DebugOut(DebugOut::Warning) << "Time Sync request failed" << endl;
}
}
}
unsubscribe(call);
}
- else if(BaseMessage::is<TimeSyncMessage>(json))
- {
- TimeSyncMessagePtr call(new TimeSyncMessage);
- call->fromJson(json);
-
- call->serverTime = amb::Timestamp::instance()->epochTime();
-
- MethodReply<TimeSyncMessage> reply(call, true);
-
- send(reply);
- }
else
{
BaseMessage call;
DebugOut(DebugOut::Warning) << "Unhandled method call: " << call.name << endl;
}
}
+ else if(BaseMessage::is<TimeSyncMessage>(json))
+ {
+ TimeSyncMessagePtr call(new TimeSyncMessage);
+ call->fromJson(json);
+
+ call->serverTime = amb::Timestamp::instance()->epochTime();
+
+ MethodReply<TimeSyncMessage> reply(call, true);
+
+ send(reply);
+ }
else
{
BaseMessage message;
public:
MethodReply(): MethodReply(nullptr, false) {}
- MethodReply(std::shared_ptr<T> t, bool success): mMethod(t), methodSuccess(success) { }
+ MethodReply(std::shared_ptr<T> t, bool success): mMethod(t), methodSuccess(success), err(AsyncPropertyReply::NoError) { }
bool methodSuccess;
picojson::value toJson()
picojson::object obj = v.get<picojson::object>();
obj["methodSuccess"] = picojson::value(methodSuccess);
+ obj["error"] = picojson::value((double)err);
return picojson::value(obj);
}
if(!mMethod) mMethod = std::shared_ptr<T>(new T());
mMethod->fromJson(json);
methodSuccess = json.get("methodSuccess").get<bool>();
+ err = AsyncPropertyReply::Error(json.get("error").get<double>());
return true;
}
static bool is(const picojson::value & v)
{
- return v.contains("methodSuccess") && T::is(v);
+ return v.contains("methodSuccess") && v.contains("error") && v.get("methodSuccess").is<bool>()
+ && v.get("error").is<double>() && T::is(v);
}
+ AsyncPropertyReply::Error error()
+ {
+ return err;
+ }
+
+ const std::string errorString() { return AsyncPropertyReply::errorToStr(err); }
+
const std::shared_ptr<T> method() { return mMethod; }
protected:
std::shared_ptr<T> mMethod;
+ AsyncPropertyReply::Error err;
};
class ListMethodCall : public MethodCall
protected:
- double correctedTime();
+ double correctTimeFromServer(double serverTimestamp);
private:
void testJsonHelper()
{
- std::string json = "{{}{}}{}";
- std::string::size_type end = 0;
- amb::findJson(json, 0, end);
-
- DebugOut(0) << "Found complete Json message at " << end << endl;
- TEST(end == 7);
}
bool TestPlugin::testSetAndGet()