Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Bazel ignore patterns
docs
meetings
48 changes: 48 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Build configuration for OpenSOVD

# Use C++20 standard
build --cxxopt=-std=c++20
build --host_cxxopt=-std=c++20

# Enable compiler warnings
build --cxxopt=-Wall
build --cxxopt=-Wextra
build --cxxopt=-Wpedantic

# Optimization flags for different build modes
build:opt --compilation_mode=opt
build:dbg --compilation_mode=dbg
build:fastbuild --compilation_mode=fastbuild

# Address sanitizer
build:asan --strip=never
build:asan --copt=-fsanitize=address
build:asan --copt=-DADDRESS_SANITIZER
build:asan --copt=-O1
build:asan --copt=-g
build:asan --copt=-fno-omit-frame-pointer
build:asan --linkopt=-fsanitize=address

# Thread sanitizer
build:tsan --strip=never
build:tsan --copt=-fsanitize=thread
build:tsan --copt=-DTHREAD_SANITIZER
build:tsan --copt=-O1
build:tsan --copt=-g
build:tsan --copt=-fno-omit-frame-pointer
build:tsan --linkopt=-fsanitize=thread

# Undefined behavior sanitizer
build:ubsan --strip=never
build:ubsan --copt=-fsanitize=undefined
build:ubsan --copt=-DUNDEFINED_BEHAVIOR_SANITIZER
build:ubsan --copt=-O1
build:ubsan --copt=-g
build:ubsan --copt=-fno-omit-frame-pointer
build:ubsan --linkopt=-fsanitize=undefined

# Coverage
build:coverage --combined_report=lcov
build:coverage --compilation_mode=dbg
build:coverage --copt=-g
build:coverage --instrument_test_targets
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ Cargo.lock
*.log
compile_commands.json

# Bazel
bazel-*

# HTML
*.html
*.htm
Expand Down
17 changes: 17 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Root BUILD file for OpenSOVD project

package(default_visibility = ["//visibility:public"])

# Build all OpenSOVD components
alias(
name = "opensovd",
actual = "//score/mw/diag:all",
)

# Filegroup for all header files (useful for IDEs)
filegroup(
name = "all_headers",
srcs = glob([
"score/**/*.h",
]),
)
12 changes: 12 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################

module(name = "opensovd", version = "0.1.0")

# Bazel dependencies
bazel_dep(name = "googletest", version = "1.14.0", repo_name = "com_google_googletest")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
24 changes: 24 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
workspace(name = "opensovd")

# C++ toolchain configuration
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Bazel skylib for common utilities
http_archive(
name = "bazel_skylib",
urls = [
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz",
],
sha256 = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94",
)

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()

# Google Test for unit testing
http_archive(
name = "com_google_googletest",
urls = ["https://github.com/google/googletest/archive/release-1.12.1.tar.gz"],
strip_prefix = "googletest-release-1.12.1",
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
)
9 changes: 9 additions & 0 deletions score/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Root BUILD file for score module

package(default_visibility = ["//visibility:public"])

# Convenience target to build all score components
alias(
name = "score",
actual = "//score/mw:diag",
)
9 changes: 9 additions & 0 deletions score/mw/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# BUILD file for mw (middleware) module

package(default_visibility = ["//visibility:public"])

# Convenience target for all diagnostic APIs
alias(
name = "diag",
actual = "//score/mw/diag:all",
)
51 changes: 51 additions & 0 deletions score/mw/diag.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/********************************************************************************
* Copyright (c) 2025 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#ifndef SCORE_MW_DIAG_H
#define SCORE_MW_DIAG_H

/// @file diag.h
/// @brief Main diagnostic API header
/// @details Include this header to access the complete diagnostic API for both UDS and SOVD

#include "diag/types.h"
#include "diag/sovd.h"
#include "diag/uds.h"

/// @namespace mw::diag
/// @brief Root namespace for diagnostic middleware
///
/// This namespace contains the abstraction layer API for diagnostic services,
/// supporting both UDS (Unified Diagnostic Services) and SOVD (Service-Oriented
/// Vehicle Diagnostics) protocols.
///
/// @namespace mw::diag::uds
/// @brief UDS-specific diagnostic services
///
/// Contains interfaces and utilities for implementing UDS diagnostic services
/// according to ISO 14229-1, including:
/// - Read/Write Data by Identifier (0x22/0x2E)
/// - Routine Control (0x31)
/// - Generic UDS service handling
/// - Serialization helpers
///
/// @namespace mw::diag::sovd
/// @brief SOVD-specific diagnostic services
///
/// Contains interfaces for implementing SOVD diagnostic services, including:
/// - Data resources (read-only, writable, and read-write)
/// - Operations (with various invocation policies)
/// - Diagnostic entities and modes
/// - JSON-based request/response handling

#endif // SCORE_MW_DIAG_H
51 changes: 51 additions & 0 deletions score/mw/diag/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# BUILD file for mw::diag diagnostic APIs

package(default_visibility = ["//visibility:public"])

# Base diagnostic types library
cc_library(
name = "types",
hdrs = ["types.h"],
deps = ["//third_party/score:result"],
)

# Diagnostic services collection base class
cc_library(
name = "diagnostic_services_collection",
hdrs = ["diagnostic_services_collection.h"],
)

# Convenience headers
cc_library(
name = "diag_header",
hdrs = ["diag.h"],
deps = [
":diagnostic_services_collection",
":types",
"//score/mw/diag/sovd:sovd_header",
"//score/mw/diag/uds:uds_header",
],
)

# SOVD API library
cc_library(
name = "sovd",
deps = ["//score/mw/diag/sovd:all"],
)

# UDS API library
cc_library(
name = "uds",
deps = ["//score/mw/diag/uds:all"],
)

# Target to build all diagnostic APIs
cc_library(
name = "all",
deps = [
":diag_header",
":sovd",
":types",
":uds",
],
)
35 changes: 35 additions & 0 deletions score/mw/diag/diagnostic_services_collection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/********************************************************************************
* Copyright (c) 2025 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#ifndef SCORE_MW_DIAG_DIAGNOSTIC_SERVICES_COLLECTION_H
#define SCORE_MW_DIAG_DIAGNOSTIC_SERVICES_COLLECTION_H

namespace mw::diag {

/// @brief Abstract base class for diagnostic services collections
/// @details Provides lifetime control for contained services
class DiagnosticServicesCollection {
public:
virtual ~DiagnosticServicesCollection() = default;

protected:
DiagnosticServicesCollection() = default;
DiagnosticServicesCollection(const DiagnosticServicesCollection&) = delete;
DiagnosticServicesCollection& operator=(const DiagnosticServicesCollection&) = delete;
DiagnosticServicesCollection(DiagnosticServicesCollection&&) = default;
DiagnosticServicesCollection& operator=(DiagnosticServicesCollection&&) = default;
};

} // namespace mw::diag

#endif // SCORE_MW_DIAG_DIAGNOSTIC_SERVICES_COLLECTION_H
29 changes: 29 additions & 0 deletions score/mw/diag/sovd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/********************************************************************************
* Copyright (c) 2025 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#ifndef SCORE_MW_DIAG_SOVD_H
#define SCORE_MW_DIAG_SOVD_H

/// @file sovd.h
/// @brief Convenience header for SOVD diagnostic API
/// @details Include this header to access all SOVD-related types and interfaces

#include "sovd/data_resource.h"
#include "sovd/diagnostic_entity.h"
#include "sovd/diagnostic_reply.h"
#include "sovd/diagnostic_request.h"
#include "sovd/diagnostic_services_collection.h"
#include "sovd/operation.h"
#include "sovd/types.h"

#endif // SCORE_MW_DIAG_SOVD_H
Loading