diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-01-02 12:58:48 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-01-02 12:58:48 +0100 |
commit | 6faef2305955b025c3cf1cfaf17a6aa073727c24 (patch) | |
tree | 4dd4ec93f9c1b0a4809338e7320bdd1589b7f80d | |
parent | d8d990528ea9746b21788f97be3fdbcc392c5d96 (diff) |
Make low-can use afb-genskel by default
Cleaning header file inclusion
Change-Id: Ic0dd9637ecd491692bd4b8b39e9602e85498c0a9
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
m--------- | conf.d/app-templates | 0 | ||||
-rw-r--r-- | conf.d/cmake/config.cmake | 2 | ||||
-rw-r--r-- | low-can-binding/CMakeLists.txt | 3 | ||||
-rw-r--r-- | low-can-binding/binding/application.cpp | 1 | ||||
-rw-r--r-- | low-can-binding/binding/application.hpp | 2 | ||||
-rw-r--r-- | low-can-binding/binding/low-can-apidef.h | 72 | ||||
-rw-r--r-- | low-can-binding/binding/low-can-hat.hpp | 15 | ||||
-rw-r--r-- | low-can-binding/binding/low-can-socket.cpp | 2 | ||||
-rw-r--r-- | low-can-binding/binding/low-can-subscription.cpp | 2 | ||||
-rw-r--r-- | low-can-binding/can/can-bus-device.hpp | 1 | ||||
-rw-r--r-- | low-can-binding/can/can-bus.hpp | 1 | ||||
-rw-r--r-- | low-can-binding/can/can-encoder.cpp | 1 | ||||
-rw-r--r-- | low-can-binding/utils/signals.hpp | 1 |
13 files changed, 39 insertions, 64 deletions
diff --git a/conf.d/app-templates b/conf.d/app-templates -Subproject dc4debf13f6653163ea969ec57945edd9545c74 +Subproject bb3c5413dd0e2ff098a99748a53be1c66186f23 diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake index 214a27eb..59a25667 100644 --- a/conf.d/cmake/config.cmake +++ b/conf.d/cmake/config.cmake @@ -26,7 +26,7 @@ set(PROJECT_ICON "icon.png") set(PROJECT_AUTHOR "Romain Forlot") set(PROJECT_AUTHOR_MAIL "romain.forlot@iot.bzh") set(PROJECT_LICENSE "APL2.0") -set(PROJECT_LANGUAGES,"C CXX") +set(PROJECT_LANGUAGES "C;CXX") # Where are stored default templates files from submodule or subtree app-templates in your project tree # relative to the root project directory diff --git a/low-can-binding/CMakeLists.txt b/low-can-binding/CMakeLists.txt index 7abb3c44..b2892cc1 100644 --- a/low-can-binding/CMakeLists.txt +++ b/low-can-binding/CMakeLists.txt @@ -46,10 +46,11 @@ PROJECT_TARGET_ADD(low-can) utils/socketcan-bcm.cpp utils/config-parser.cpp) + set(OPENAPI_DEF "binding/low-can-apidef" CACHE STRING "name and path to the JSON API definition without extension") # Binder exposes a unique public entry point SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "afb-" - LABELS "BINDING" + LABELS "BINDINGV2" LINK_FLAGS ${BINDINGS_LINK_FLAG} OUTPUT_NAME ${TARGET_NAME} ) diff --git a/low-can-binding/binding/application.cpp b/low-can-binding/binding/application.cpp index 8c210177..6f2310c1 100644 --- a/low-can-binding/binding/application.cpp +++ b/low-can-binding/binding/application.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "application.hpp" #include "../utils/signals.hpp" diff --git a/low-can-binding/binding/application.hpp b/low-can-binding/binding/application.hpp index e2728060..c75a178c 100644 --- a/low-can-binding/binding/application.hpp +++ b/low-can-binding/binding/application.hpp @@ -27,8 +27,6 @@ #include "../can/can-signals.hpp" #include "../diagnostic/diagnostic-manager.hpp" -#include "low-can-hat.hpp" - /// /// @brief Class representing a configuration attached to the binding. /// diff --git a/low-can-binding/binding/low-can-apidef.h b/low-can-binding/binding/low-can-apidef.h index d8edab62..d66af134 100644 --- a/low-can-binding/binding/low-can-apidef.h +++ b/low-can-binding/binding/low-can-apidef.h @@ -21,46 +21,42 @@ static const char _afb_description_v2_low_can[] = "properties\":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-event\"},\"" "event\":{\"type\":\"string\"},\"data\":{\"type\":\"object\"}}}},\"x-perm" "issions\":{\"monitor\":{\"permission\":\"urn:AGL:permission:low-can:publ" - "ic:monitor\"},\"write\":{\"permission\":\"urn:AGL:permission:low-can:pla" - "tform:write\"}},\"responses\":{\"200\":{\"description\":\"A complex obje" - "ct array response\",\"content\":{\"application/json\":{\"schema\":{\"$re" - "f\":\"#/components/schemas/afb-reply\"}}}}}},\"paths\":{\"/subscribe\":{" - "\"description\":\"Subscribe to CAN signals events\",\"parameters\":[{\"i" - "n\":\"query\",\"name\":\"event\",\"required\":false,\"schema\":{\"type\"" - ":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses" - "/200\"}}},\"/unsubscribe\":{\"description\":\"Unsubscribe previously sus" - "cribed signals.\",\"parameters\":[{\"in\":\"query\",\"name\":\"event\",\"" - "required\":false,\"schema\":{\"type\":\"string\"}}],\"responses\":{\"200" - "\":{\"$ref\":\"#/components/responses/200\"}}},\"/get\":{\"description\"" - ":\"get a current value of CAN message\",\"parameters\":[{\"in\":\"query\"" - ",\"name\":\"event\",\"required\":false,\"schema\":{\"type\":\"string\"}}" - "],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/" - "list\":{\"description\":\"get a supported CAN message list\",\"responses" - "\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/auth\":{\"des" - "cription\":\"Authenticate session to be raise Level Of Assurance.\",\"ge" - "t\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/write\"},\"" - "responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\"/wri" - "te\":{\"description\":\"Write a CAN messages to the CAN bus.\",\"get\":{" - "\"x-permissions\":{\"LOA\":1},\"parameters\":[{\"in\":\"query\",\"name\"" - ":\"bus_name\",\"required\":false,\"schema\":{\"type\":\"string\"}},{\"in" - "\":\"query\",\"name\":\"frame\",\"required\":false,\"schema\":{\"type\":" - "\"array\"},\"parameters\":[{\"in\":\"query\",\"name\":\"can_id\",\"requi" - "red\":false,\"schema\":{\"type\":\"string\"}},{\"in\":\"query\",\"name\"" - ":\"can_dlc\",\"required\":false,\"schema\":{\"type\":\"string\"}},{\"in\"" - ":\"query\",\"name\":\"can_data\",\"required\":false,\"schema\":{\"type\"" - ":\"string\"}}]},{\"in\":\"query\",\"name\":\"signal_name\",\"required\":" - "false,\"schema\":{\"type\":\"string\"}},{\"in\":\"query\",\"name\":\"sig" - "nal_value\",\"required\":false,\"schema\":{\"type\":\"integer\"}}],\"res" - "ponses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}}}}" + "ic:monitor\"},\"write\":{\"permission\":\"urn:AGL:permission::platform:c" + "an:write \"}},\"responses\":{\"200\":{\"description\":\"A complex object" + " array response\",\"content\":{\"application/json\":{\"schema\":{\"$ref\"" + ":\"#/components/schemas/afb-reply\"}}}}}},\"paths\":{\"/subscribe\":{\"d" + "escription\":\"Subscribe to CAN signals events\",\"parameters\":[{\"in\"" + ":\"query\",\"name\":\"event\",\"required\":false,\"schema\":{\"type\":\"" + "string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/20" + "0\"}}},\"/unsubscribe\":{\"description\":\"Unsubscribe previously suscri" + "bed signals.\",\"parameters\":[{\"in\":\"query\",\"name\":\"event\",\"re" + "quired\":false,\"schema\":{\"type\":\"string\"}}],\"responses\":{\"200\"" + ":{\"$ref\":\"#/components/responses/200\"}}},\"/get\":{\"description\":\"" + "get a current value of CAN message\",\"parameters\":[{\"in\":\"query\",\"" + "name\":\"event\",\"required\":false,\"schema\":{\"type\":\"string\"}}],\"" + "responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/list" + "\":{\"description\":\"get a supported CAN message list\",\"responses\":{" + "\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/auth\":{\"descrip" + "tion\":\"Authenticate session to be raise Level Of Assurance.\",\"get\":" + "{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/write\"},\"res" + "ponses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}},\"/write\"" + ":{\"description\":\"Write a CAN messages to the CAN bus.\",\"get\":{\"x-" + "permissions\":{\"LOA\":1},\"parameters\":[{\"in\":\"query\",\"name\":\"b" + "us_name\",\"required\":false,\"schema\":{\"type\":\"string\"}},{\"in\":\"" + "query\",\"name\":\"frame\",\"required\":false,\"schema\":{\"type\":\"arr" + "ay\"},\"parameters\":[{\"in\":\"query\",\"name\":\"can_id\",\"required\"" + ":false,\"schema\":{\"type\":\"string\"}},{\"in\":\"query\",\"name\":\"ca" + "n_dlc\",\"required\":false,\"schema\":{\"type\":\"string\"}},{\"in\":\"q" + "uery\",\"name\":\"can_data\",\"required\":false,\"schema\":{\"type\":\"s" + "tring\"}}]},{\"in\":\"query\",\"name\":\"signal_name\",\"required\":fals" + "e,\"schema\":{\"type\":\"string\"}},{\"in\":\"query\",\"name\":\"signal_" + "value\",\"required\":false,\"schema\":{\"type\":\"integer\"}}],\"respons" + "es\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}}}}" ; -#ifdef __cplusplus -#include <afb/afb-binding> -#endif -/*static const struct afb_auth _afb_auths_v2_low_can[] = { - { .type = afb_auth_Permission, .text = "urn:AGL:permission::platform:can:write", .next = NULL} -};*/ -const struct afb_auth _afb_auths_v2_low_can[] = {afb::auth_permission("urn:AGL:permission::platform:can:write")}; +static const struct afb_auth _afb_auths_v2_low_can[] = { + afb::auth_permission("urn:AGL:permission::platform:can:write ") +}; void subscribe(struct afb_req req); void unsubscribe(struct afb_req req); diff --git a/low-can-binding/binding/low-can-hat.hpp b/low-can-binding/binding/low-can-hat.hpp index d9fb89f2..5722666c 100644 --- a/low-can-binding/binding/low-can-hat.hpp +++ b/low-can-binding/binding/low-can-hat.hpp @@ -24,11 +24,8 @@ #include <memory> #include <systemd/sd-event.h> -extern "C" -{ - #define AFB_BINDING_VERSION 2 - #include <afb/afb-binding.h> -}; +#define AFB_BINDING_VERSION 2 +#include <afb/afb-binding> class low_can_subscription_t; @@ -36,11 +33,3 @@ int initv2(); void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, std::map<int, std::shared_ptr<low_can_subscription_t> >& s); void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, uint32_t pid, std::map<int, std::shared_ptr<low_can_subscription_t> >& s); int read_message(sd_event_source *s, int fd, uint32_t revents, void *userdata); -/* -void auth(struct afb_req request); -void subscribe(struct afb_req request); -void unsubscribe(struct afb_req request); -void write(struct afb_req request); -void get(struct afb_req request); -void list(struct afb_req request); -*/ diff --git a/low-can-binding/binding/low-can-socket.cpp b/low-can-binding/binding/low-can-socket.cpp index afdc9860..c479a0ad 100644 --- a/low-can-binding/binding/low-can-socket.cpp +++ b/low-can-binding/binding/low-can-socket.cpp @@ -16,8 +16,6 @@ * limitations under the License. */ -#include "low-can-hat.hpp" - #include "low-can-subscription.hpp" #include "application.hpp" #include "canutil/write.h" diff --git a/low-can-binding/binding/low-can-subscription.cpp b/low-can-binding/binding/low-can-subscription.cpp index 5bb79a15..20287b88 100644 --- a/low-can-binding/binding/low-can-subscription.cpp +++ b/low-can-binding/binding/low-can-subscription.cpp @@ -16,8 +16,6 @@ * limitations under the License. */ -#include "low-can-hat.hpp" - #include "low-can-subscription.hpp" #include "application.hpp" #include "canutil/write.h" diff --git a/low-can-binding/can/can-bus-device.hpp b/low-can-binding/can/can-bus-device.hpp index 0b979b1c..af705515 100644 --- a/low-can-binding/can/can-bus-device.hpp +++ b/low-can-binding/can/can-bus-device.hpp @@ -28,7 +28,6 @@ #include "openxc.pb.h" #include "can-message.hpp" #include "../utils/config-parser.hpp" -#include "../binding/low-can-hat.hpp" #include "../binding/low-can-subscription.hpp" /// @brief A container for a CAN module paried with a certain bus. diff --git a/low-can-binding/can/can-bus.hpp b/low-can-binding/can/can-bus.hpp index 00c740cf..71abe41a 100644 --- a/low-can-binding/can/can-bus.hpp +++ b/low-can-binding/can/can-bus.hpp @@ -28,7 +28,6 @@ #include "openxc.pb.h" #include "can-message.hpp" #include "../utils/config-parser.hpp" -#include "../binding/low-can-hat.hpp" #include "../binding/low-can-subscription.hpp" // TODO actual max is 32 but dropped to 24 for memory considerations diff --git a/low-can-binding/can/can-encoder.cpp b/low-can-binding/can/can-encoder.cpp index e0015da2..5dc632b3 100644 --- a/low-can-binding/can/can-encoder.cpp +++ b/low-can-binding/can/can-encoder.cpp @@ -20,7 +20,6 @@ #include "canutil/write.h" #include "../utils/openxc-utils.hpp" #include "can-message-definition.hpp" -#include "../binding/low-can-hat.hpp" /// @brief Write a value into a CAN signal in the destination buffer. /// diff --git a/low-can-binding/utils/signals.hpp b/low-can-binding/utils/signals.hpp index ddaf229b..65316a7d 100644 --- a/low-can-binding/utils/signals.hpp +++ b/low-can-binding/utils/signals.hpp @@ -26,7 +26,6 @@ #include "../can/can-signals.hpp" #include "../diagnostic/diagnostic-message.hpp" -#include "../binding/low-can-hat.hpp" #include "../binding/low-can-subscription.hpp" namespace utils |