Skip to content

Commit ef931ee

Browse files
SebaLukasa-w50corneliusclaussenSiebrenW
authored
ISO15118-20 beta release: (#7)
- Evse offers DC & DC_BPT, added some AC messages (wip) - Network supports two connections (tcp and tls) - TLS 1.3 support with mbedtls 3.5 (cross-compiling is supported) - Interface name and keyfiles password are configurable - Added exi logging and ssl logging - Added stop from charger - Added correct wait time before closing the connection (tls and tcp) - fix float to RationalNumber negative numbers lower than -200 ish (#2) Signed-off-by: Sebastian Lukas <sebastian.lukas@pionix.de> Co-authored-by: aw <aw@pionix.de> Co-authored-by: Cornelius Claussen <cc@pionix.de> Co-authored-by: Siebren Weertman <siebren.w@gmail.com>
1 parent 695e9bf commit ef931ee

File tree

209 files changed

+138419
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+138419
-2
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*build
2+
.vscode
3+
pki
4+
test/sample_data

3rd_party/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if (ISO15118_LINK_CUSTOM_MBEDTLS)
2+
add_subdirectory(mbedtls)
3+
endif ()

3rd_party/mbedtls/CMakeLists.txt

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
include(ExternalProject)
2+
3+
if (CMAKE_CROSSCOMPILING)
4+
if (NOT CMAKE_TOOLCHAIN_FILE)
5+
message(FATAL "Cross-compiling the custom mbedtls library without supplying CMAKE_TOOLCHAIN_FILE is not supported")
6+
endif ()
7+
set (CUSTOM_MBEDTLS_CROSSCOMPILE_DEF "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
8+
endif ()
9+
10+
set(ENABLE_TLS13_HEADER_CONFIG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/config_enable_tls13.h)
11+
12+
set(CUSTOM_MBEDTLS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_mbedtls-build)
13+
14+
set(STATIC_MBEDTLS_DIR "${CUSTOM_MBEDTLS_BINARY_DIR}/library/libmbedtls.a")
15+
set(STATIC_MBEDX509_DIR "${CUSTOM_MBEDTLS_BINARY_DIR}/library/libmbedx509.a")
16+
set(STATIC_MBEDCRYPT_DIR "${CUSTOM_MBEDTLS_BINARY_DIR}/library/libmbedcrypto.a")
17+
18+
ExternalProject_Add(custom_mbedtls
19+
BINARY_DIR
20+
${CUSTOM_MBEDTLS_BINARY_DIR}
21+
GIT_REPOSITORY
22+
https://github.com/Mbed-TLS/mbedtls.git
23+
GIT_TAG
24+
mbedtls-3.5.0
25+
CMAKE_ARGS
26+
${CUSTOM_MBEDTLS_CROSSCOMPILE_DEF}
27+
-DENABLE_PROGRAMS=OFF
28+
-DENABLE_TESTING=OFF
29+
-DDISABLE_PACKAGE_CONFIG_AND_INSTALL=ON
30+
-DMBEDTLS_USER_CONFIG_FILE=${ENABLE_TLS13_HEADER_CONFIG_FILE}
31+
# library should be build static by default
32+
INSTALL_COMMAND
33+
""
34+
BUILD_BYPRODUCTS
35+
${STATIC_MBEDTLS_DIR}
36+
${STATIC_MBEDX509_DIR}
37+
${STATIC_MBEDCRYPT_DIR}
38+
)
39+
40+
ExternalProject_Get_Property(custom_mbedtls SOURCE_DIR)
41+
42+
# well known hack for ExternalProject with include directories ...
43+
set(CUSTOM_MBEDTLS_INCLUDE_DIR ${SOURCE_DIR}/include)
44+
file(MAKE_DIRECTORY ${CUSTOM_MBEDTLS_INCLUDE_DIR})
45+
46+
add_library(mbedtls_custom STATIC IMPORTED GLOBAL)
47+
target_compile_definitions(mbedtls_custom
48+
INTERFACE
49+
MBEDTLS_USER_CONFIG_FILE="${ENABLE_TLS13_HEADER_CONFIG_FILE}"
50+
)
51+
set_target_properties(mbedtls_custom
52+
PROPERTIES
53+
IMPORTED_LOCATION ${STATIC_MBEDTLS_DIR}
54+
INTERFACE_INCLUDE_DIRECTORIES ${CUSTOM_MBEDTLS_INCLUDE_DIR}
55+
)
56+
add_dependencies(mbedtls_custom custom_mbedtls)
57+
58+
add_library(mbedx509_custom STATIC IMPORTED GLOBAL)
59+
target_compile_definitions(mbedx509_custom
60+
INTERFACE
61+
MBEDTLS_USER_CONFIG_FILE="${ENABLE_TLS13_HEADER_CONFIG_FILE}"
62+
)
63+
set_target_properties(mbedx509_custom
64+
PROPERTIES
65+
IMPORTED_LOCATION ${STATIC_MBEDX509_DIR}
66+
INTERFACE_INCLUDE_DIRECTORIES ${CUSTOM_MBEDTLS_INCLUDE_DIR}
67+
)
68+
add_dependencies(mbedx509_custom custom_mbedtls)
69+
70+
add_library(mbedcrypto_custom STATIC IMPORTED GLOBAL)
71+
target_compile_definitions(mbedcrypto_custom
72+
INTERFACE
73+
MBEDTLS_USER_CONFIG_FILE="${ENABLE_TLS13_HEADER_CONFIG_FILE}"
74+
)
75+
set_target_properties(mbedcrypto_custom
76+
PROPERTIES
77+
IMPORTED_LOCATION ${STATIC_MBEDCRYPT_DIR}
78+
INTERFACE_INCLUDE_DIRECTORIES ${CUSTOM_MBEDTLS_INCLUDE_DIR}
79+
)
80+
add_dependencies(mbedcrypto_custom custom_mbedtls)
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define MBEDTLS_SSL_PROTO_TLS1_3
2+
#define MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE

CMakeLists.txt

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
project(iso15118
4+
VERSION 0.1
5+
DESCRIPTION "iso15118 library suite"
6+
LANGUAGES CXX C
7+
)
8+
9+
find_package(everest-cmake 0.1 REQUIRED
10+
PATHS ../everest-cmake
11+
)
12+
13+
# options
14+
option(OPT_AUTODOWNLOAD_ISO20_SCHEMAS "\
15+
Automatically download ISO15118-20 schemas. Note: by setting this option to \
16+
true and hence downloading the schema files, YOU accept the ISO Customer \
17+
Licence Agreement (“Licence Agreement”), clauses 1. ISO’s Copyright, \
18+
7. Termination, 8. Limitations, and 9. Governing Law." OFF)
19+
20+
option(ISO15118_LINK_CUSTOM_MBEDTLS "\
21+
Link against a pinned mbedtls library\
22+
" ON)
23+
24+
25+
add_subdirectory(3rd_party)
26+
add_subdirectory(input)
27+
add_subdirectory(src)
28+
29+
if (ISO15118_BUILD_TESTS)
30+
include(CTest)
31+
add_subdirectory(test)
32+
endif()
33+
34+
if (ISO15118_INSTALL)
35+
install(
36+
TARGETS
37+
cb_v2gtp
38+
cb_exi_codec
39+
cb_iso20
40+
iso15118
41+
EXPORT iso15118-targets
42+
)
43+
44+
install(
45+
DIRECTORY include/
46+
TYPE INCLUDE
47+
PATTERN "detail" EXCLUDE
48+
)
49+
50+
evc_setup_package(
51+
NAME iso15118
52+
EXPORT iso15118-targets
53+
NAMESPACE iso15118
54+
)
55+
endif()

README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
ISO 15118 library suite
22
=======================
33

4-
Currently, this is a proof of concept library. Therefore it is located
5-
in the branch `dash-20-poc`.
4+
Currently, this is a proof of concept library.
65

76
Integration of ISO 15118 development for EVerest is under heavy development
87
currently. Many features are already implemented, many are still to follow.
@@ -25,3 +24,20 @@ This is just a short overview to show you that there is not the one and
2524
only place for the ISO 15118 implementation. For more information and
2625
insights on that, join us in our
2726
[weekly tech meetups](https://everest.github.io/nightly/#weekly-tech-meetup).
27+
28+
## Dependencies
29+
30+
To build this library you need [libfsm](https://github.com/EVerest/libfsm) and [everest-cmake](https://github.com/EVerest/everest-cmake) checkout in the same directory as libiso15118.
31+
32+
## Getting started
33+
34+
```
35+
# Run cmake (ISO15118_BUILD_TESTS to enable/disable unit tests)
36+
cmake -S . -B build -G Ninja -DISO15118_BUILD_TESTS=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=1
37+
38+
# Build
39+
ninja -C build
40+
41+
# Running tests
42+
ninja -C build test
43+
```

include/exi/cb/appHand_Datatypes.h

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
/*
3+
* Copyright (C) 2022 - 2023 chargebyte GmbH
4+
* Copyright (C) 2022 - 2023 Contributors to EVerest
5+
*/
6+
7+
/*****************************************************
8+
*
9+
* @author
10+
* @version
11+
*
12+
* The Code is generated! Changes may be overwritten.
13+
*
14+
*****************************************************/
15+
16+
/**
17+
* @file appHand_Datatypes.h
18+
* @brief Description goes here
19+
*
20+
**/
21+
22+
#ifndef APP_HANDSHAKE_DATATYPES_H
23+
#define APP_HANDSHAKE_DATATYPES_H
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
30+
#include <stddef.h>
31+
#include <stdint.h>
32+
33+
34+
35+
#define appHand_ProtocolNamespace_CHARACTER_SIZE 100
36+
#define appHand_AppProtocolType_5_ARRAY_SIZE 5
37+
38+
39+
// enum for function numbers
40+
typedef enum {
41+
appHand_supportedAppProtocolReq = 0,
42+
appHand_supportedAppProtocolRes = 1
43+
} appHand_generatedFunctionNumbersType;
44+
45+
// Element: definition=enum; name=ResponseCode; type={urn:iso:15118:2:2010:AppProtocol}responseCodeType; base type=string; content type=simple;
46+
// abstract=False; final=False; derivation=restriction;
47+
typedef enum {
48+
appHand_responseCodeType_OK_SuccessfulNegotiation = 0,
49+
appHand_responseCodeType_OK_SuccessfulNegotiationWithMinorDeviation = 1,
50+
appHand_responseCodeType_Failed_NoNegotiation = 2
51+
} appHand_responseCodeType;
52+
53+
// Element: definition=complex; name=AppProtocol; type={urn:iso:15118:2:2010:AppProtocol}AppProtocolType; base type=; content type=ELEMENT-ONLY;
54+
// abstract=False; final=False;
55+
// Particle: ProtocolNamespace, protocolNamespaceType (1, 1); VersionNumberMajor, unsignedInt (1, 1); VersionNumberMinor, unsignedInt (1, 1); SchemaID, idType (1, 1); Priority, priorityType (1, 1);
56+
struct appHand_AppProtocolType {
57+
// ProtocolNamespace, protocolNamespaceType (base: anyURI)
58+
struct {
59+
char characters[appHand_ProtocolNamespace_CHARACTER_SIZE];
60+
uint16_t charactersLen;
61+
} ProtocolNamespace;
62+
// VersionNumberMajor, unsignedInt (base: unsignedLong)
63+
uint32_t VersionNumberMajor;
64+
// VersionNumberMinor, unsignedInt (base: unsignedLong)
65+
uint32_t VersionNumberMinor;
66+
// SchemaID, idType (base: unsignedByte)
67+
uint8_t SchemaID;
68+
// Priority, priorityType (base: unsignedByte)
69+
uint8_t Priority;
70+
71+
};
72+
73+
// Element: definition=complex; name={urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolReq; type=AnonymousType; base type=; content type=ELEMENT-ONLY;
74+
// abstract=False; final=False;
75+
// Particle: AppProtocol, AppProtocolType (1, 5);
76+
struct appHand_supportedAppProtocolReq {
77+
// AppProtocol, AppProtocolType
78+
struct {
79+
struct appHand_AppProtocolType array[appHand_AppProtocolType_5_ARRAY_SIZE];
80+
uint16_t arrayLen;
81+
} AppProtocol;
82+
};
83+
84+
// Element: definition=complex; name={urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolRes; type=AnonymousType; base type=; content type=ELEMENT-ONLY;
85+
// abstract=False; final=False;
86+
// Particle: ResponseCode, responseCodeType (1, 1); SchemaID, idType (0, 1);
87+
struct appHand_supportedAppProtocolRes {
88+
// ResponseCode, responseCodeType (base: string)
89+
appHand_responseCodeType ResponseCode;
90+
// SchemaID, idType (base: unsignedByte)
91+
uint8_t SchemaID;
92+
unsigned int SchemaID_isUsed:1;
93+
94+
};
95+
96+
97+
98+
// root elements of EXI doc
99+
struct appHand_exiDocument {
100+
union {
101+
struct appHand_supportedAppProtocolReq supportedAppProtocolReq;
102+
struct appHand_supportedAppProtocolRes supportedAppProtocolRes;
103+
};
104+
unsigned int supportedAppProtocolReq_isUsed:1;
105+
unsigned int supportedAppProtocolRes_isUsed:1;
106+
};
107+
108+
// init for structs
109+
void init_appHand_exiDocument(struct appHand_exiDocument* exiDoc);
110+
void init_appHand_supportedAppProtocolReq(struct appHand_supportedAppProtocolReq* supportedAppProtocolReq);
111+
void init_appHand_supportedAppProtocolRes(struct appHand_supportedAppProtocolRes* supportedAppProtocolRes);
112+
void init_appHand_AppProtocolType(struct appHand_AppProtocolType* AppProtocolType);
113+
114+
115+
#ifdef __cplusplus
116+
}
117+
#endif
118+
119+
#endif /* APP_HANDSHAKE_DATATYPES_H */
120+

include/exi/cb/appHand_Decoder.h

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
/*
3+
* Copyright (C) 2022 - 2023 chargebyte GmbH
4+
* Copyright (C) 2022 - 2023 Contributors to EVerest
5+
*/
6+
7+
/*****************************************************
8+
*
9+
* @author
10+
* @version
11+
*
12+
* The Code is generated! Changes may be overwritten.
13+
*
14+
*****************************************************/
15+
16+
/**
17+
* @file appHand_Decoder.h
18+
* @brief Description goes here
19+
*
20+
**/
21+
22+
#ifndef APP_HANDSHAKE_DECODER_H
23+
#define APP_HANDSHAKE_DECODER_H
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
30+
#include "common/exi_basetypes.h"
31+
#include "common/exi_bitstream.h"
32+
#include "appHand_Datatypes.h"
33+
34+
35+
// main function for decoding
36+
int decode_appHand_exiDocument(exi_bitstream_t* stream, struct appHand_exiDocument* exiDoc);
37+
38+
#ifdef __cplusplus
39+
}
40+
#endif
41+
42+
#endif /* APP_HANDSHAKE_DECODER_H */
43+

include/exi/cb/appHand_Encoder.h

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
/*
3+
* Copyright (C) 2022 - 2023 chargebyte GmbH
4+
* Copyright (C) 2022 - 2023 Contributors to EVerest
5+
*/
6+
7+
/*****************************************************
8+
*
9+
* @author
10+
* @version
11+
*
12+
* The Code is generated! Changes may be overwritten.
13+
*
14+
*****************************************************/
15+
16+
/**
17+
* @file appHand_Encoder.h
18+
* @brief Description goes here
19+
*
20+
**/
21+
22+
#ifndef APP_HANDSHAKE_ENCODER_H
23+
#define APP_HANDSHAKE_ENCODER_H
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
30+
#include "common/exi_basetypes.h"
31+
#include "common/exi_bitstream.h"
32+
#include "appHand_Datatypes.h"
33+
34+
35+
// main function for encoding
36+
int encode_appHand_exiDocument(exi_bitstream_t* stream, struct appHand_exiDocument* exiDoc);
37+
38+
#ifdef __cplusplus
39+
}
40+
#endif
41+
42+
#endif /* APP_HANDSHAKE_ENCODER_H */
43+

0 commit comments

Comments
 (0)