[AMB] - updated version number. we are now 0.15 development
authorKevron Rees <kevron.m.rees@intel.com>
Thu, 5 Feb 2015 23:32:20 +0000 (15:32 -0800)
committerKevron Rees <kevron.m.rees@intel.com>
Thu, 5 Feb 2015 23:32:20 +0000 (15:32 -0800)
CMakeLists.txt
README.md
RELEASE.in.md
RELEASE.md
lib/jsonhelper.cpp
lib/jsonhelper.h
plugins/common/jsonprotocol.cpp
plugins/common/jsonprotocol.h
plugins/testplugin/testplugin.cpp

index 429d1fd..f5b4ce2 100644 (file)
@@ -8,12 +8,12 @@ include(CMakeDependentOption)
 
 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}")
index 41a3b0a..9c4afa8 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # Automotive Message Broker Daemon {#ambd}
 
-Version 0.13.900
+Version 0.14.800
 
 ## Introduction
 
@@ -60,7 +60,7 @@ You will also need to edit your config to enable the Qt-based mainloop:
 
 ~~~~~~~~~~~~~{.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"
 }
 ~~~~~~~~~~~~~
index 999ffc9..f545161 100644 (file)
@@ -2,24 +2,8 @@
 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
index 27f5f31..c97e2a1 100644 (file)
@@ -1,25 +1,9 @@
 # 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
index 98654c9..ff1d879 100644 (file)
@@ -146,26 +146,3 @@ GVariant *amb::jsonToGVariant(const picojson::value & value, const std::string&
 
        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;
-       }
-}
index f573749..70eb286 100644 (file)
@@ -46,8 +46,6 @@ std::shared_ptr<AbstractPropertyType> jsonToProperty(const picojson::value& json
 
 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
index 9406997..79e00fc 100644 (file)
@@ -29,7 +29,9 @@ bool readCallback(GIOChannel *source, GIOCondition condition, gpointer data)
 amb::AmbRemoteClient::AmbRemoteClient(AbstractIo *io)
        :BaseJsonMessageReader(io), serverTimeOffset(0)
 {
+       TimeSyncMessage timeSyncRequest;
 
+       send(timeSyncRequest);
 }
 
 void amb::AmbRemoteClient::list(amb::AmbRemoteClient::ListCallback cb)
@@ -125,6 +127,11 @@ void amb::AmbRemoteClient::unsubscribe(const string &subscribeId)
        }
 }
 
+double amb::AmbRemoteClient::correctTimeFromServer(double serverTimestamp)
+{
+       return serverTimestamp - serverTimeOffset;
+}
+
 void amb::AmbRemoteClient::hasJsonMessage(const picojson::value &json)
 {
        DebugOut(7) << "json: " << json.serialize() << endl;
@@ -198,9 +205,20 @@ void amb::AmbRemoteClient::hasJsonMessage(const picojson::value &json)
                                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;
                }
        }
 }
@@ -516,17 +534,6 @@ void amb::AmbRemoteServer::hasJsonMessage(const picojson::value &json)
 
                        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;
@@ -534,6 +541,17 @@ void amb::AmbRemoteServer::hasJsonMessage(const picojson::value &json)
                        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;
index cae7200..55ee24a 100644 (file)
@@ -163,7 +163,7 @@ class MethodReply
 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()
@@ -172,6 +172,7 @@ public:
 
                picojson::object obj = v.get<picojson::object>();
                obj["methodSuccess"] = picojson::value(methodSuccess);
+               obj["error"] = picojson::value((double)err);
 
                return picojson::value(obj);
        }
@@ -181,19 +182,29 @@ public:
                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
@@ -446,7 +457,7 @@ public:
 
 protected:
 
-       double correctedTime();
+       double correctTimeFromServer(double serverTimestamp);
 
 private:
 
index 05097b0..d854d5f 100644 (file)
@@ -275,13 +275,7 @@ bool testListPlusPlus()
 
 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()