X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=low-can-binding%2Futils%2Fsocketcan.hpp;h=17cec01930316d2c8b648789b2e777ae4bbbd042;hb=04b7efcdd1a8dfdf461c78d083aabee5445e54bd;hp=fdf8c949089fede352d1d410bc9be69753b79565;hpb=d2d2620bbb8f0aad0181e67e9f6affc3d6cb4a51;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/utils/socketcan.hpp b/low-can-binding/utils/socketcan.hpp index fdf8c949..17cec019 100644 --- a/low-can-binding/utils/socketcan.hpp +++ b/low-can-binding/utils/socketcan.hpp @@ -1,7 +1,7 @@ #pragma once /* - * Copyright (C) 2015, 2016 ,2017 "IoT.bzh" + * Copyright (C) 2015, 2016 , 2017, 2018, 2019 "IoT\.bzh" * Author "Romain Forlot" * Author "Loïc Collignon" * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,12 +21,14 @@ #include #include +#include #include #include "../binding/low-can-hat.hpp" #include "../can/message/can-message.hpp" #define INVALID_SOCKET -1 +#define NO_CAN_ID 0xFFFFFFFFU namespace utils { @@ -48,14 +50,14 @@ namespace utils int setopt(int level, int optname, const void* optval, socklen_t optlen); virtual int close(); virtual std::shared_ptr read_message() = 0; - virtual void write_message(std::shared_ptr obj) = 0; - virtual void write_message(std::vector>& vobj) = 0; + virtual int write_message(message_t& obj) = 0; + virtual int write_message(std::vector& vobj); protected: int socket_; struct sockaddr_can tx_address_; int open(int domain, int type, int protocol); + int bind(const struct sockaddr* addr, socklen_t len); + int connect(const struct sockaddr* addr, socklen_t len); }; - - }