X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=low-can-binding%2Fbinding%2Flow-can-hat.hpp;h=e748c9604b092f1bb456bef60085a09aaf66f60a;hb=HEAD;hp=eafb9c69062978717b82088d56f5125ac1ad188e;hpb=1a90edea7d3d45da772c590d642c0093839cc91f;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/binding/low-can-hat.hpp b/low-can-binding/binding/low-can-hat.hpp index eafb9c69..e748c960 100644 --- a/low-can-binding/binding/low-can-hat.hpp +++ b/low-can-binding/binding/low-can-hat.hpp @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + #pragma once #include @@ -23,20 +23,23 @@ #include #include #include - -extern "C" -{ - #define AFB_BINDING_VERSION 2 - #include -}; +#include +#include +#include class low_can_subscription_t; -void on_no_clients(std::shared_ptr can_subscription, std::map >& s); -void on_no_clients(std::shared_ptr can_subscription, uint32_t pid, std::map >& s); +typedef std::map> map_subscription; + +void on_no_clients(std::shared_ptr can_subscription, map_subscription& s); +void on_no_clients(std::shared_ptr can_subscription, uint32_t pid, map_subscription& 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); +inline bool caseInsCharCompareN(char a, char b) { + return(toupper(a) == toupper(b)); +} + +inline bool caseInsCompare(const std::string& s1, const std::string& s2) { + return((s1.size() == s2.size()) && + equal(s1.begin(), s1.end(), s2.begin(), caseInsCharCompareN)); +}