Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
structs.hpp
Go to the documentation of this file.
1
2#ifndef IV_SRC_COMMS_CANJ1939_STRUCTS_HPP_
3#define IV_SRC_COMMS_CANJ1939_STRUCTS_HPP_
4
6#include "core/enums.hpp"
8#include "third_party/JSON.hpp"
9
10#include <cstdint>
11
12using JSON = nlohmann::json;
13
14namespace iv::comms::canJ1939
15{
16
17struct SpnInfo
18{
19 bool read(const JSON &pgnJSON, iv::types::comms::spn spn);
20 bool write(JSON &pgnJSON) const;
21
23
24 std::string m_name; // Name of the SPN
25 std::string m_description;// Description of the SPN
26
29
32
33 uint32_t m_startingBit;
34 uint32_t m_length;
35
36 std::optional<iv::types::channelValue> m_min {std::nullopt};
37 std::optional<iv::types::channelValue> m_max {std::nullopt};
38
40};
41
42struct PgnInfo
43{
44 bool read(const JSON &pgnJSON, iv::types::comms::pgn pgn);
45 bool write(JSON &pgnJSON) const;
46
48 uint32_t m_length; // Number of SPNs
49 std::string m_name; // Name of the PGN
50
51 std::map<iv::types::comms::spn, SpnInfo> m_SPNs;// SPNs in the PGN
52};
53
60
62{
65 std::vector<CanJ1939Filter> filterSPNs;
67 std::weak_ptr<iv::channels::AbstractChannel> channel;
68};
69
71{
73 std::weak_ptr<iv::channels::AbstractChannel> channel;
74};
75
87}// namespace iv::comms::canJ1939
88#endif//IV_SRC_COMMS_CANJ1939_STRUCTS_HPP_
nlohmann::json JSON
Definition structs.hpp:7
Definition CanJ1939CommunicationController.cpp:13
eJ1939TransportProtocol
Definition enums.hpp:47
uint32_t pgn
Definition defines.hpp:25
uint32_t spn
Definition defines.hpp:26
uint8_t j1939SourceAddress
Definition defines.hpp:29
uint8_t fmi
Definition defines.hpp:23
uint64_t timestamp
Definition types.hpp:21
double channelValue
Definition types.hpp:67
eEndianType
Definition enums.hpp:220
eMeasurementUnit
Definition enums.hpp:103
eDataType
Definition enums.hpp:207
iv::types::comms::spn spn
Definition structs.hpp:64
std::weak_ptr< iv::channels::AbstractChannel > channel
Definition structs.hpp:67
std::vector< CanJ1939Filter > filterSPNs
Definition structs.hpp:65
iv::eDataType dataType
Definition structs.hpp:66
iv::types::comms::pgn pgn
Definition structs.hpp:63
std::weak_ptr< iv::channels::AbstractChannel > channel
Definition structs.hpp:73
iv::types::comms::fmi fmi
Definition structs.hpp:72
Definition structs.hpp:55
iv::eDataType dataType
Definition structs.hpp:57
iv::types::channelValue value
Definition structs.hpp:58
iv::types::comms::spn spn
Definition structs.hpp:56
Definition structs.hpp:43
iv::types::comms::pgn m_pgn
Definition structs.hpp:47
bool write(JSON &pgnJSON) const
Definition structs.cpp:318
std::string m_name
Definition structs.hpp:49
std::map< iv::types::comms::spn, SpnInfo > m_SPNs
Definition structs.hpp:51
uint32_t m_length
Definition structs.hpp:48
bool read(const JSON &pgnJSON, iv::types::comms::pgn pgn)
Definition structs.cpp:283
Definition structs.hpp:18
uint32_t m_startingBit
Definition structs.hpp:33
iv::eMeasurementUnit m_unit
Definition structs.hpp:39
iv::types::channelValue m_offset
Definition structs.hpp:31
iv::types::comms::spn m_spn
Definition structs.hpp:22
bool read(const JSON &pgnJSON, iv::types::comms::spn spn)
Definition structs.cpp:337
uint32_t m_length
Definition structs.hpp:34
std::optional< iv::types::channelValue > m_max
Definition structs.hpp:37
iv::eEndianType m_endianness
Definition structs.hpp:28
bool write(JSON &pgnJSON) const
Definition structs.cpp:425
std::string m_name
Definition structs.hpp:24
std::optional< iv::types::channelValue > m_min
Definition structs.hpp:36
iv::types::channelValue m_factor
Definition structs.hpp:30
std::string m_description
Definition structs.hpp:25
bool m_isSigned
Definition structs.hpp:27
iv::types::comms::j1939SourceAddress sourceAddress
Definition structs.hpp:82
std::vector< std::byte > data
Definition structs.hpp:84
eJ1939TransportProtocol transportProtocol
Definition structs.hpp:83
iv::types::timestamp lastPacketProcessed
Definition structs.hpp:85
iv::types::comms::pgn pgn
Definition structs.hpp:81