Files
SOMEIP/source/soa_server/spi_server.hpp

120 lines
4.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*============================================================================*/
/* Copyright (C) huaxu (2022).
*
* All rights reserved. This software is huaxu property. Duplication
* or disclosure without huaxu written authorization is prohibited.
*
* @file someip_client.hpp
* @brief head file of someip client
* @author LiuZhimin
* @date 2026-02-24 15:20:00
*/
/*============================================================================*/
/*=======[R E V I S I O N H I S T O R Y]====================================*/
/* <VERSION> <DATE> <AUTHOR> <REVISION LOG>
* V0.0.1 20260606 Liuzhimin Initial Version
*/
/*============================================================================*/
#ifndef SPI_SERVER_HPP
#define SPI_SERVER_HPP
/*=======[I N C L U D E S]====================================================*/
#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
#include <csignal>
#endif
#include <chrono>
#include <condition_variable>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <thread>
#include <vsomeip/vsomeip.hpp>
#include <mutex>
#include <vector>
/*=======[M A C R O S]========================================================*/
#define CAN_CHANNEL_COUNT 6
#ifdef USE_LOG_MODULE
#include "log_mgt_api.h"
#ifdef LOG_TAG_SOMEIP
#undef LOG_TAG_SOMEIP
#endif
#define LOG_TAG_SOMEIP "spi_server"
#define someip_log_d(...) \
do \
{ \
Log.d(LOG_TAG_SOMEIP, ##__VA_ARGS__); \
} while (0)
#define someip_log_i(...) \
do \
{ \
Log.i(LOG_TAG_SOMEIP, ##__VA_ARGS__); \
} while (0)
#define someip_log_w(...) \
do \
{ \
Log.w(LOG_TAG_SOMEIP, ##__VA_ARGS__); \
} while (0)
#define someip_log_e(...) \
do \
{ \
Log.e(LOG_TAG_SOMEIP, ##__VA_ARGS__); \
} while (0)
#else
#ifdef LOG_TAG_SOMEIP
#undef LOG_TAG_SOMEIP
#endif
#define LOG_TAG_SOMEIP "spi_server"
#define someip_log_d(format, ...) \
do \
{ \
printf("D %s ", LOG_TAG_SOMEIP); \
printf(format, ##__VA_ARGS__); \
printf("\n"); \
} while (0)
#define someip_log_i(format, ...) \
do \
{ \
printf("I %s ", LOG_TAG_SOMEIP); \
printf(format, ##__VA_ARGS__); \
printf("\n"); \
} while (0)
#define someip_log_w(format, ...) \
do \
{ \
printf("W %s ", LOG_TAG_SOMEIP); \
printf(format, ##__VA_ARGS__); \
printf("\n"); \
} while (0)
#define someip_log_e(format, ...) \
do \
{ \
printf("E %s ", LOG_TAG_SOMEIP); \
printf(format, ##__VA_ARGS__); \
printf("\n"); \
} while (0)
#endif
/*=======[P A R A M T Y P E D E F]==========================================*/
/*=======[E X P O R T D A T A]==============================================*/
/* CAN 数据缓冲区 — SPI 线程写入notifier 线程读取 */
extern std::vector<uint8_t> g_can_data[CAN_CHANNEL_COUNT];
extern std::mutex g_can_mutex[CAN_CHANNEL_COUNT];
/*=======[E X P O R T F U N C T I O N D E C L A R A T I O N S]============*/
extern void my_spi_server_thread_func(void* arg);
/*=======[L O C A L D A T A]================================================*/
/*=======[C L A S S I M P L E M E N T A T I O N S]==========================*/
#endif // SPI_SERVER_HPP