Skip to content

Commit

Permalink
Canservice
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladaekyung committed Nov 23, 2023
1 parent 4659c9a commit e9b9be8
Show file tree
Hide file tree
Showing 30 changed files with 3,211 additions and 17 deletions.
1,130 changes: 1,130 additions & 0 deletions Yocto/poky/build/bitbake-cookerdaemon.log

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Yocto/poky/build/conf/local.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ IMAGE_INSTALL:append = " packagegroup-core-x11-base"
IMAGE_INSTALL:append = " packagegroup-core-x11-sato"
IMAGE_INSTALL:append = " packagegroup-core-x11-xserver"
IMAGE_INSTALL:append = " dlt-daemon"
IMAGE_INSTALL:append = " vsomeip-example"
IMAGE_INSTALL:append = " vsomeip-can"
IMAGE_INSTALL:append = " vsomeip-piracer"
IMAGE_INSTALL:append = " boost"
IMAGE_INSTALL:append = " common-api-c++"
IMAGE_INSTALL:append = " common-api-c++-someip"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[program:canservice]
command=/usr/bin/example/vsomeip-example/CANService
command=/usr/bin/vsomeip/CANService
autostart=true
autorestart=true
stderr_logfile=/var/log/canservice.err.log
stdout_logfile=/var/log/canservice.out.log

[program:piracerservice]
command=/usr/bin/example/vsomeip-example/PiracerService
command=/usr/bin/vsomeip/PiracerService
autostart=true
autorestart=true
stderr_logfile=/var/log/piracerservice.err.log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ int main() {

std::shared_ptr<CANStubImpl> junhoService = std::make_shared<CANStubImpl>();
while (!runtime->registerService(domain, instance, junhoService, connection)) {
std::cout << "Register Service failed, trying again in 100 milliseconds..." << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}

std::cout << "Successfully Registered Service!" << std::endl;

while (true) {
nbytes = read(s, &frame, sizeof(struct can_frame));

Expand All @@ -51,12 +48,6 @@ int main() {
if (nbytes > 0 && frame.can_id == FCAN_ID) {
junhoService->fdisPublisher(frame.data[2]);
}

for (int i = 0; i <= frame.can_dlc; i++)
printf("%02X ",frame.data[i]);
printf("\n");

printf("\n");
}
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ void CANStubImpl::rdisPublisher(const uint8_t rdis) {
if (_rdis != rdis) {
_rdis = rdis;
setRdisAttribute(_rdis);
std::cout << "New CAN Rear Distance Data = " << int(_rdis) << "!" << std::endl;
//std::cout << "New CAN Rear Distance Data = " << int(_rdis) << "!" << std::endl;
}
}

void CANStubImpl::fdisPublisher(const uint8_t fdis) {
if (_fdis != fdis) {
_fdis = fdis;
setFdisAttribute(_fdis);
std::cout << "New CAN Front Distance Data = " << int(_fdis) << "!" << std::endl;
//std::cout << "New CAN Front Distance Data = " << int(_fdis) << "!" << std::endl;
}
}

void CANStubImpl::rpmPublisher(const uint8_t rpm) {
if (_rpm != rpm) {
_rpm = rpm;
setRpmAttribute(_rpm);
std::cout << "New CAN RPM Data = " << int(_rpm) << "!" << std::endl;
//std::cout << "New CAN RPM Data = " << int(_rpm) << "!" << std::endl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ inherit cmake
DEPENDS = " \
common-api-c++ \
vsomeip \
common-api-c++-someip\
common-api-c++-someip \
"

RDEPENDS:{PN} += " \
common-api-c++ \
vsomeip \
common-api-c++-someip\
common-api-c++-someip \
"

EXTRA_OECMAKE += " \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 2.8)

# Find the Python3 libraries
find_package(Python3 COMPONENTS Development)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++0x")

include_directories(
src-gen
${CMAKE_INCLUDE_PATH}/CommonAPI-3.2
${CMAKE_INCLUDE_PATH}
)
link_directories(
${CMAKE_LIBRARY_PATH}
)

add_executable(PiracerClient
src/PiracerClient.cpp
src-gen/v1/commonapi/PiracerSomeIPProxy.cpp
src-gen/v1/commonapi/PiracerSomeIPDeployment.cpp
)
target_link_libraries(PiracerClient CommonAPI CommonAPI-SomeIP vsomeip3)

add_executable(PiracerService
src/PiracerInterface.cpp
src/PiracerClass.cpp
src/GamePad.cpp
src/PiracerStubImpl.cpp
src-gen/v1/commonapi/PiracerSomeIPProxy.cpp
src-gen/v1/commonapi/PiracerSomeIPDeployment.cpp
src-gen/v1/commonapi/PiracerSomeIPStubAdapter.cpp
)
target_link_libraries(PiracerService Python3::Python pthread CommonAPI CommonAPI-SomeIP vsomeip3)
add_executable(PiracerService_test
src/PiracerService_test.cpp
src/PiracerClass.cpp
src/GamePad.cpp
src/PiracerStubImpl.cpp
src-gen/v1/commonapi/PiracerSomeIPProxy.cpp
src-gen/v1/commonapi/PiracerSomeIPDeployment.cpp
src-gen/v1/commonapi/PiracerSomeIPStubAdapter.cpp
)
target_link_libraries(PiracerService_test Python3::Python pthread CommonAPI CommonAPI-SomeIP vsomeip3)

install(TARGETS PiracerClient DESTINATION /usr/bin/vsomeip)
install(TARGETS PiracerService DESTINATION /usr/bin/vsomeip)
install(TARGETS PiracerService_test DESTINATION /usr/bin/vsomeip)
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* This file was generated by the CommonAPI Generators.
* Used org.genivi.commonapi.core 3.2.0.v202012010850.
* Used org.franca.core 0.13.1.201807231814.
*
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at
* http://mozilla.org/MPL/2.0/.
*/
#ifndef V1_COMMONAPI_PIRACER_HPP_
#define V1_COMMONAPI_PIRACER_HPP_




#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
#define HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE
#endif

#include <CommonAPI/Types.hpp>

#if defined (HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE)
#undef COMMONAPI_INTERNAL_COMPILATION
#undef HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE
#endif

namespace v1 {
namespace commonapi {

class Piracer {
public:
virtual ~Piracer() { }

static inline const char* getInterface();
static inline CommonAPI::Version getInterfaceVersion();
};

const char* Piracer::getInterface() {
return ("commonapi.Piracer:v1_0");
}

CommonAPI::Version Piracer::getInterfaceVersion() {
return CommonAPI::Version(1, 0);
}


} // namespace commonapi
} // namespace v1

namespace CommonAPI {
}


// Compatibility
namespace v1_0 = v1;

#endif // V1_COMMONAPI_PIRACER_HPP_
Loading

0 comments on commit e9b9be8

Please sign in to comment.