├── .clang-format ├── .clang-tidy ├── .flake8 ├── .git-blame-ignore-revs ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── template │ ├── docker-build │ │ └── action.yml │ └── fwe-build │ │ └── action.yml └── workflows │ └── ci.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .prettierignore ├── .prettierrc.yaml ├── CHANGELOG.md ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── NOTICE ├── README.md ├── SECURITY.md ├── THIRD-PARTY-LICENSES ├── cmake ├── AwsIotFweConfig.cmake.in ├── capicxx_gen.cmake ├── capicxx_gen_log4j_config.xml ├── clang_tidy.cmake ├── compiler_gcc.cmake ├── doxygen.cmake ├── graphviz.cmake ├── micropython.cmake ├── unit_test.cmake └── valgrind.cmake ├── configuration └── static-config.json ├── dependencies └── micropython │ ├── micropython_config.c │ ├── micropython_embed.mk │ ├── mpconfigport.h │ └── qstrdefsport.h ├── docs ├── AWS-IoTFleetWiseOffboarding.md ├── dev-guide │ ├── adding-custom-fidl-file-dev-guide.md │ ├── can-actuators-dev-guide.md │ ├── can-over-someip-demo.md │ ├── custom-function-dev-guide.md │ ├── edge-agent-dev-guide-device-shadow-over-someip.md │ ├── edge-agent-dev-guide-last-known-state.md │ ├── edge-agent-dev-guide-nxp-s32g.md │ ├── edge-agent-dev-guide-renesas-rcar-s4.md │ ├── edge-agent-dev-guide-someip.md │ ├── edge-agent-dev-guide.md │ ├── edge-agent-uds-dtc-dev-guide.md │ ├── images │ │ ├── architecture.png │ │ ├── can-over-someip-demo-diagram.jpg │ │ ├── collected_data_plot.png │ │ ├── collected_data_plot_someip.png │ │ ├── last-known-state-diagram.jpg │ │ ├── rcar-s4-spider.jpg │ │ ├── s32g_golden_box.png │ │ ├── snf-forwarding-data-diagram.png │ │ ├── snf-high-level-diagram.png │ │ ├── snf-storing-data-diagram.png │ │ ├── snf-stream-management-diagram.png │ │ ├── someip-collection-diagram.jpg │ │ ├── someip-commands-diagram.jpg │ │ └── uds-dtc-architecture-uml.png │ ├── network-agnostic-dev-guide.md │ ├── store-and-forward-dev-guide.md │ └── vision-system-data │ │ ├── data │ │ ├── campaign-brake-event-vision-system-data.json │ │ ├── campaign-vision-system-data-heartbeat.json │ │ ├── network-interfaces.json │ │ └── ros2-config.json │ │ ├── foxglove-studio-screenshot.jpg │ │ ├── vision-system-data-demo-diagram.jpg │ │ ├── vision-system-data-demo.ipynb │ │ └── vision-system-data-foxglove-layout.json ├── iot-FleetWise-architecture.png ├── iwave-g26-tutorial │ ├── iwave-g26-tutorial.md │ ├── obd-port-1.jpg │ └── obd-port-2.jpg ├── metrics.md └── rpi-tutorial │ └── raspberry-pi-tutorial.md ├── examples ├── CMakeLists.txt ├── README.md ├── custom_function │ ├── CMakeLists.txt │ ├── CustomFunctionCounter.cpp │ ├── CustomFunctionCounter.h │ ├── CustomFunctionFileSize.cpp │ ├── CustomFunctionFileSize.h │ ├── CustomFunctionSin.cpp │ ├── CustomFunctionSin.h │ ├── README.md │ ├── campaign-counter.json │ ├── campaign-file-size.json │ ├── campaign-sin.json │ ├── custom-decoders-file-size.json │ ├── custom-nodes-file-size.json │ └── main.cpp ├── mqtt_pub_sub │ ├── CMakeLists.txt │ ├── README.md │ └── main.cpp ├── network_agnostic_actuator_commands │ ├── AcCommandDispatcher.cpp │ ├── AcCommandDispatcher.h │ ├── CMakeLists.txt │ ├── README.md │ ├── custom-decoders-ac-actuators.json │ ├── custom-nodes-ac-actuators.json │ ├── main.cpp │ └── network-interface-custom-ac-actuators.json ├── network_agnostic_data_collection │ ├── CMakeLists.txt │ ├── MyCounterDataSource.cpp │ ├── MyCounterDataSource.h │ ├── MyCustomDataSource.cpp │ ├── MyCustomDataSource.h │ ├── README.md │ ├── campaign-nadc-example-heartbeat.json │ ├── custom-decoders-my-counter.json │ ├── custom-decoders-my-custom.json │ ├── custom-decoders-my-location.json │ ├── custom-nodes-my-counter.json │ ├── custom-nodes-my-custom.json │ ├── main.cpp │ ├── network-interface-custom-my-counter.json │ └── network-interface-custom-my-custom.json ├── s3_upload │ ├── CMakeLists.txt │ ├── MyS3Upload.cpp │ ├── MyS3Upload.h │ ├── README.md │ └── main.cpp └── someip │ ├── CMakeLists.txt │ ├── MySomeipDataSource.cpp │ ├── MySomeipDataSource.h │ ├── MySomeipInterfaceWrapper.cpp │ ├── MySomeipInterfaceWrapper.h │ ├── README.md │ ├── campaign-my-someip-heartbeat.json │ ├── custom-decoders-my-someip.json │ ├── custom-nodes-my-someip.json │ ├── fidl │ ├── MySomeipInterface.fdepl │ └── MySomeipInterface.fidl │ ├── main.cpp │ └── network-interface-custom-my-someip.json ├── include └── aws │ └── iotfleetwise │ ├── AaosVhalSource.h │ ├── ActuatorCommandManager.h │ ├── Assert.h │ ├── AwsBootstrap.h │ ├── AwsGreengrassCoreIpcClientWrapper.h │ ├── AwsGreengrassV2ConnectivityModule.h │ ├── AwsGreengrassV2Receiver.h │ ├── AwsGreengrassV2Sender.h │ ├── AwsIotConnectivityModule.h │ ├── AwsIotReceiver.h │ ├── AwsIotSender.h │ ├── AwsSDKMemoryManager.h │ ├── CANDataConsumer.h │ ├── CANDataSource.h │ ├── CANDataTypes.h │ ├── CANDecoder.h │ ├── CANInterfaceIDTranslator.h │ ├── CPUUsageInfo.h │ ├── CacheAndPersist.h │ ├── CanCommandDispatcher.h │ ├── CheckinSender.h │ ├── Clock.h │ ├── ClockHandler.h │ ├── CollectionInspectionAPITypes.h │ ├── CollectionInspectionEngine.h │ ├── CollectionInspectionWorkerThread.h │ ├── CollectionSchemeIngestion.h │ ├── CollectionSchemeIngestionList.h │ ├── CollectionSchemeManager.h │ ├── CommandResponseDataSender.h │ ├── CommandSchema.h │ ├── CommandTypes.h │ ├── ConsoleLogger.h │ ├── Credentials.h │ ├── CustomFunctionCPython.h │ ├── CustomFunctionMath.h │ ├── CustomFunctionMicroPython.h │ ├── CustomFunctionMultiRisingEdgeTrigger.h │ ├── CustomFunctionScriptEngine.h │ ├── DataFetchManager.h │ ├── DataFetchManagerAPITypes.h │ ├── DataSenderIonWriter.h │ ├── DataSenderManager.h │ ├── DataSenderManagerWorkerThread.h │ ├── DataSenderProtoWriter.h │ ├── DataSenderTypes.h │ ├── DecoderManifestIngestion.h │ ├── DeviceShadowOverSomeip.h │ ├── EnumUtility.h │ ├── EventTypes.h │ ├── ExampleSomeipInterfaceWrapper.h │ ├── ExampleUDSInterface.h │ ├── ExternalCANDataSource.h │ ├── ExternalGpsSource.h │ ├── ICollectionScheme.h │ ├── ICollectionSchemeList.h │ ├── ICommandDispatcher.h │ ├── IConnectionTypes.h │ ├── IConnectivityModule.h │ ├── IDecoderDictionary.h │ ├── IDecoderManifest.h │ ├── ILogger.h │ ├── IReceiver.h │ ├── IRemoteDiagnostics.h │ ├── ISOTPOverCANOptions.h │ ├── ISOTPOverCANReceiver.h │ ├── ISOTPOverCANSender.h │ ├── ISOTPOverCANSenderReceiver.h │ ├── ISender.h │ ├── ISomeipInterfaceWrapper.h │ ├── IWaveGpsSource.h │ ├── IoTFleetWiseConfig.h │ ├── IoTFleetWiseEngine.h │ ├── IoTFleetWiseVersion.h │ ├── LastKnownStateDataSender.h │ ├── LastKnownStateIngestion.h │ ├── LastKnownStateInspector.h │ ├── LastKnownStateSchema.h │ ├── LastKnownStateTypes.h │ ├── LastKnownStateWorkerThread.h │ ├── Listener.h │ ├── LogLevel.h │ ├── LoggingModule.h │ ├── MemoryUsageInfo.h │ ├── MessageTypes.h │ ├── MqttClientWrapper.h │ ├── NamedSignalDataSource.h │ ├── OBDDataDecoder.h │ ├── OBDDataTypes.h │ ├── OBDOverCANECU.h │ ├── OBDOverCANModule.h │ ├── PayloadManager.h │ ├── QueueTypes.h │ ├── ROS2DataSource.h │ ├── RawDataManager.h │ ├── RemoteDiagnosticDataSource.h │ ├── RemoteProfiler.h │ ├── RetryThread.h │ ├── S3Sender.h │ ├── Schema.h │ ├── SchemaListener.h │ ├── Signal.h │ ├── SignalTypes.h │ ├── SomeipCommandDispatcher.h │ ├── SomeipDataSource.h │ ├── SomeipToCanBridge.h │ ├── StreambufBuilder.h │ ├── TelemetryDataSender.h │ ├── Thread.h │ ├── TimeTypes.h │ ├── Timer.h │ ├── TopicConfig.h │ ├── TraceModule.h │ ├── TransferManagerWrapper.h │ ├── VehicleDataSourceTypes.h │ ├── VisionSystemDataSender.h │ └── snf │ ├── DataSenderProtoReader.h │ ├── IoTJobsDataRequestHandler.h │ ├── RateLimiter.h │ ├── StoreFileSystem.h │ ├── StoreLogger.h │ ├── StreamForwarder.h │ └── StreamManager.h ├── interfaces ├── persistency │ ├── examples │ │ └── persistencyMetadataFormat.json │ └── schemas │ │ └── persistencyMetadataFormat.json ├── protobuf │ └── schemas │ │ ├── cloudToCustomer │ │ └── last_known_state_message.proto │ │ ├── cloudToEdge │ │ ├── collection_schemes.proto │ │ ├── command_request.proto │ │ ├── common_types.proto │ │ ├── decoder_manifest.proto │ │ └── state_templates.proto │ │ ├── edgeConfiguration │ │ └── staticConfiguration.json │ │ └── edgeToCloud │ │ ├── checkin.proto │ │ ├── command_response.proto │ │ ├── last_known_state_data.proto │ │ ├── vehicle_data.proto │ │ └── vision_system_data.isl ├── someip │ └── fidl │ │ ├── DeviceShadowOverSomeipInterface.fdepl │ │ ├── DeviceShadowOverSomeipInterface.fidl │ │ ├── ExampleSomeipInterface.fdepl │ │ └── ExampleSomeipInterface.fidl └── uds-dtc │ └── udsDtcSchema.json ├── package.xml ├── pyproject.toml ├── src ├── AaosVhalSource.cpp ├── ActuatorCommandManager.cpp ├── AwsBootstrap.cpp ├── AwsGreengrassV2ConnectivityModule.cpp ├── AwsGreengrassV2Receiver.cpp ├── AwsGreengrassV2Sender.cpp ├── AwsIotConnectivityModule.cpp ├── AwsIotReceiver.cpp ├── AwsIotSender.cpp ├── AwsSDKMemoryManager.cpp ├── CANDataConsumer.cpp ├── CANDataSource.cpp ├── CANDecoder.cpp ├── CPUUsageInfo.cpp ├── CacheAndPersist.cpp ├── CanCommandDispatcher.cpp ├── CheckinSender.cpp ├── ClockHandler.cpp ├── CollectionInspectionEngine.cpp ├── CollectionInspectionWorkerThread.cpp ├── CollectionSchemeIngestion.cpp ├── CollectionSchemeIngestionList.cpp ├── CollectionSchemeManager.cpp ├── CommandResponseDataSender.cpp ├── CommandSchema.cpp ├── ConsoleLogger.cpp ├── Credentials.cpp ├── CustomFunctionCPython.cpp ├── CustomFunctionMath.cpp ├── CustomFunctionMicroPython.cpp ├── CustomFunctionMultiRisingEdgeTrigger.cpp ├── CustomFunctionScriptEngine.cpp ├── DataFetchManager.cpp ├── DataSenderIonWriter.cpp ├── DataSenderManager.cpp ├── DataSenderManagerWorkerThread.cpp ├── DataSenderProtoWriter.cpp ├── DecoderDictionaryExtractor.cpp ├── DecoderManifestIngestion.cpp ├── DeviceShadowOverSomeip.cpp ├── ExampleUDSInterface.cpp ├── ExternalCANDataSource.cpp ├── ExternalGpsSource.cpp ├── ISOTPOverCANReceiver.cpp ├── ISOTPOverCANSender.cpp ├── ISOTPOverCANSenderReceiver.cpp ├── IWaveGpsSource.cpp ├── InspectionMatrixExtractor.cpp ├── IoTFleetWiseConfig.cpp ├── IoTFleetWiseEngine.cpp ├── IoTFleetWiseVersion.cpp.in ├── LastKnownStateDataSender.cpp ├── LastKnownStateIngestion.cpp ├── LastKnownStateInspector.cpp ├── LastKnownStateSchema.cpp ├── LastKnownStateWorkerThread.cpp ├── LoggingModule.cpp ├── MemoryUsageInfo.cpp ├── NamedSignalDataSource.cpp ├── OBDDataDecoder.cpp ├── OBDOverCANECU.cpp ├── OBDOverCANModule.cpp ├── PayloadManager.cpp ├── Persistency.cpp ├── ROS2DataSource.cpp ├── RawDataManager.cpp ├── RemoteDiagnosticDataSource.cpp ├── RemoteProfiler.cpp ├── RetryThread.cpp ├── S3Sender.cpp ├── Schema.cpp ├── SomeipCommandDispatcher.cpp ├── SomeipDataSource.cpp ├── SomeipToCanBridge.cpp ├── TelemetryDataSender.cpp ├── Thread.cpp ├── TraceModule.cpp ├── VisionSystemDataSender.cpp ├── android_shared_library.cpp ├── main.cpp └── snf │ ├── DataSenderProtoReader.cpp │ ├── IoTJobsDataRequestHandler.cpp │ ├── RateLimiter.cpp │ ├── StoreFileSystem.cpp │ ├── StoreLogger.cpp │ ├── StreamForwarder.cpp │ └── StreamManager.cpp ├── test ├── system │ ├── .gitignore │ ├── README.md │ ├── conftest.py │ ├── doc │ │ └── vision-system-data-offline-testing.md │ ├── loadtest.py │ ├── long_avg_complex_data.py │ ├── long_avg_load_test_all_features.py │ ├── long_avg_loadtest.py │ ├── pytest.ini │ ├── requirements.txt │ ├── test_checkins.py │ ├── test_complex_conditions.py │ ├── test_complex_data.py │ ├── test_corrupted_proto_ingestion.py │ ├── test_custom_function.py │ ├── test_device_shadow.py │ ├── test_dtc.py │ ├── test_heartbeat.py │ ├── test_heartbeat_29bit.py │ ├── test_heartbeat_can_fd.py │ ├── test_heartbeat_can_to_someip_bridge.py │ ├── test_heartbeat_obd_broadcast.py │ ├── test_heartbeat_someip.py │ ├── test_incorrect_collection_scheme.py │ ├── test_large_proto.py │ ├── test_last_known_state.py │ ├── test_multiple_policies.py │ ├── test_network.py │ ├── test_remote_commands.py │ ├── test_remote_profiler.py │ ├── test_someip.py │ ├── test_store_and_forward_campaign.py │ ├── test_uds_dtc_generic.py │ ├── test_unknown_signal.py │ ├── testframework │ │ ├── aws_thing_creator.py │ │ ├── can_fd.dbc │ │ ├── can_gateway.py │ │ ├── collection_schemes_incorrect_format.proto │ │ ├── common.py │ │ ├── context.py │ │ ├── cyclonedds.xml │ │ ├── cyclonedds_hil.xml │ │ ├── cyclonedds_network_namespace.xml │ │ ├── gen.sh │ │ ├── greengrass.py │ │ ├── greengrass_nucleus_config.yaml │ │ ├── network_namespace.py │ │ ├── nodes_to_vss_json.py │ │ ├── obdPidDecoderManifestDemo.json │ │ ├── obd_config_sample.json │ │ ├── obd_config_sample_29bit.json │ │ ├── obd_config_sample_broadcast.json │ │ ├── process_utils.py │ │ ├── protofactory.py │ │ ├── ros2-config-data-engine-e2e-test.json │ │ ├── ros2-config.json │ │ ├── ros2_custom_messages │ │ │ ├── CMakeLists.txt │ │ │ ├── msg │ │ │ │ ├── DifferentTypesTest.msg │ │ │ │ ├── Nested2TestMessage.msg │ │ │ │ ├── NestedTestMessage.msg │ │ │ │ ├── PumpUpMessageMain.msg │ │ │ │ ├── PumpUpMessageNested1.msg │ │ │ │ ├── PumpUpMessageNested2.msg │ │ │ │ └── PumpUpMessageNestedEnd.msg │ │ │ ├── package.xml │ │ │ └── scripts │ │ │ │ ├── generate_msgs_files.py │ │ │ │ └── publish_pump_up_message.py │ │ ├── ros_config.json │ │ ├── ros_config_high_load.json │ │ ├── ros_vals_default.json │ │ ├── sample.dbc │ │ ├── sample_high_bus_load.dbc │ │ ├── setup-network-namespace.sh │ │ ├── someip.py │ │ ├── someip_routing_manager.py │ │ └── vals_sample_default.json │ └── valgrind.supp └── unit │ ├── AaosVhalSourceTest.cpp │ ├── ActuatorCommandManagerTest.cpp │ ├── AwsGreengrassV2ConnectivityModuleTest.cpp │ ├── AwsIotConnectivityModuleTest.cpp │ ├── CANDataSourceTest.cpp │ ├── CANDecoderTest.cpp │ ├── CPUUsageInfoTest.cpp │ ├── CacheAndPersistTest.cpp │ ├── CanCommandDispatcherTest.cpp │ ├── ClockHandlerBenchmarkTest.cpp │ ├── ClockHandlerTest.cpp │ ├── CollectionInspectionEngineTest.cpp │ ├── CollectionInspectionWorkerThreadTest.cpp │ ├── CollectionSchemeManagerGtest.cpp │ ├── CollectionSchemeManagerTest.cpp │ ├── CommandSchemaTest.cpp │ ├── CredentialsTest.cpp │ ├── CustomFunctionMathTest.cpp │ ├── CustomFunctionMultiRisingEdgeTriggerTest.cpp │ ├── CustomFunctionPythonTest.cpp │ ├── DataFetchManagerTest.cpp │ ├── DataSenderIonWriterTest.cpp │ ├── DataSenderManagerTest.cpp │ ├── DataSenderManagerWorkerThreadTest.cpp │ ├── DataSenderProtoWriterTest.cpp │ ├── DecoderDictionaryExtractorTest.cpp │ ├── DeviceShadowOverSomeipTest.cpp │ ├── ExampleUDSInterfaceTest.cpp │ ├── ExternalCANDataSourceTest.cpp │ ├── ExternalGpsSourceTest.cpp │ ├── FakeSystemTimeTest.cpp │ ├── ISOTPOverCANProtocolTest.cpp │ ├── IWaveGpsSourceTest.cpp │ ├── InspectionMatrixExtractorTest.cpp │ ├── IoTFleetWiseConfigTest.cpp │ ├── IoTFleetWiseEngineTest.cpp │ ├── LastKnownStateInspectorTest.cpp │ ├── LastKnownStateSchemaTest.cpp │ ├── LastKnownStateWorkerThreadTest.cpp │ ├── LoggingModuleTest.cpp │ ├── MemoryUsageInfoTest.cpp │ ├── NamedSignalDataSourceTest.cpp │ ├── OBDDataDecoderTest.cpp │ ├── OBDOverCANModuleTest.cpp │ ├── PayloadManagerTest.cpp │ ├── PersistencyTest.cpp │ ├── ROS2DataSourceTest.cpp │ ├── RawDataManagerTest.cpp │ ├── RemoteProfilerTest.cpp │ ├── S3SenderTest.cpp │ ├── SchemaTest.cpp │ ├── SomeipCommandDispatcherTest.cpp │ ├── SomeipDataSourceTest.cpp │ ├── SomeipToCanBridgeTest.cpp │ ├── ThreadTest.cpp │ ├── TimerTest.cpp │ ├── TraceModuleTest.cpp │ ├── WaitUntilTest.cpp │ ├── snf │ ├── DataSenderProtoReaderTest.cpp │ ├── IoTJobsDataRequestHandlerTest.cpp │ ├── RateLimiterTest.cpp │ ├── StoreFileSystemTest.cpp │ ├── StoreLoggerTest.cpp │ ├── StreamForwarderTest.cpp │ └── StreamManagerTest.cpp │ └── support │ ├── AwsGreengrassCoreIpcClientWrapperMock.h │ ├── CollectionSchemeManagerMock.h │ ├── CollectionSchemeManagerTest.h │ ├── CommandDispatcherMock.h │ ├── CommonAPIProxyMock.h │ ├── ConnectivityModuleMock.h │ ├── DataSenderIonWriterMock.h │ ├── DataSenderManagerMock.h │ ├── ExampleSomeipInterfaceProxyMock.h │ ├── Faketime.h │ ├── MqttClientWrapperMock.h │ ├── OBDDataTypesUnitTestOnly.h │ ├── PayloadManagerMock.h │ ├── RawDataBufferManagerSpy.h │ ├── S3SenderMock.h │ ├── SenderMock.h │ ├── SomeipMock.h │ ├── StreamForwarderMock.h │ ├── StreamManagerMock.h │ ├── StringbufBuilder.h │ ├── Testing.h │ ├── TransferManagerWrapperMock.h │ ├── WaitUntil.h │ ├── main.cpp │ ├── ros2-mock-include │ ├── rclcpp │ │ └── rclcpp.hpp │ ├── rcpputils │ │ └── shared_library.hpp │ └── rosidl_typesupport_introspection_cpp │ │ ├── field_types.hpp │ │ ├── identifier.hpp │ │ ├── message_introspection.hpp │ │ └── message_type_support_decl.hpp │ ├── static-config-corrupt.json │ ├── static-config-inline-creds.json │ ├── static-config-ok.json │ ├── test_module.py │ └── valgrind.supp └── tools ├── android-app ├── .gitignore ├── README.md ├── app │ ├── .gitignore │ ├── build.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ ├── AmazonRootCA1.pem │ │ └── config-0.json │ │ ├── java │ │ └── com │ │ │ └── aws │ │ │ └── iotfleetwise │ │ │ ├── AboutActivity.java │ │ │ ├── BluetoothActivity.java │ │ │ ├── ConfigureVehicleActivity.java │ │ │ ├── Elm327.java │ │ │ ├── Fwe.java │ │ │ ├── FweApplication.java │ │ │ ├── MainActivity.java │ │ │ └── StatusEditTextPreference.java │ │ └── res │ │ ├── layout │ │ ├── activity_about.xml │ │ ├── activity_bluetooth_device_list.xml │ │ ├── activity_configure_vehicle.xml │ │ ├── activity_main.xml │ │ └── bluetooth_device.xml │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.webp │ │ ├── values-night │ │ └── themes.xml │ │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ │ └── xml │ │ └── preferences.xml ├── build.gradle ├── cloud │ ├── .gitignore │ ├── campaign-android-aaos-vhal.json │ ├── campaign-android-obd.json │ ├── custom-decoders-aaos-vhal.json │ ├── custom-nodes-aaos-vhal.json │ ├── gen-aaos-vhal-info.py │ ├── network-interface-custom-aaos-vhal.json │ └── provision.sh ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── arm64-toolchain.cmake ├── arm64.list ├── armhf-toolchain.cmake ├── armhf.list ├── build-dist.sh ├── build-fwe-cross-android.sh ├── build-fwe-cross-arm64.sh ├── build-fwe-cross-armhf.sh ├── build-fwe-native.sh ├── can-to-someip ├── .gitignore ├── README.md ├── can-to-someip.cmake ├── can-to-someip.py └── main.cpp ├── cansim ├── can_command_server.py ├── canigen.py ├── cansim.py ├── cansim@.service ├── hscan.dbc ├── obd_config.json └── run-cansim.sh ├── cfn-templates ├── fwdemo.yml ├── fwdev.yml ├── fwremoteprofiler.yml ├── iot-credentials-provider.yml └── vision-system-data-jupyter.yml ├── cloud ├── .gitignore ├── README.md ├── campaign-brake-event-vision-system-data.json ├── campaign-brake-event.json ├── campaign-math.json ├── campaign-multi-rising-edge-trigger.json ├── campaign-obd-and-location-heartbeat.json ├── campaign-obd-heartbeat.json ├── campaign-python-histogram.json ├── campaign-someip-heartbeat.json ├── campaign-store-only-no-upload.json ├── campaign-uds-dtc-condition-based-fetch.json ├── campaign-uds-dtc-time-based-fetch.json ├── campaign-upload-critical-during-hard-braking.json ├── campaign-upload-during-wifi.json ├── clean-up.sh ├── custom-decoders-can-actuators.json ├── custom-decoders-histogram.json ├── custom-decoders-location.json ├── custom-decoders-multi-rising-edge-trigger.json ├── custom-decoders-someip.json ├── custom-decoders-uds-dtc.json ├── custom-function-python-histogram │ └── histogram.py ├── custom-nodes-can-actuators.json ├── custom-nodes-histogram.json ├── custom-nodes-location.json ├── custom-nodes-multi-rising-edge-trigger.json ├── custom-nodes-someip.json ├── custom-nodes-uds-dtc.json ├── dbc-to-decoders.py ├── dbc-to-nodes.py ├── demo.sh ├── firehose-to-html.py ├── hscan.dbc ├── install-deps.sh ├── iot-topic-subscribe.py ├── iot-topic-to-html.py ├── lks-subscribe.py ├── manage-service-role.sh ├── network-interface-can.json ├── network-interface-custom-can-actuators.json ├── network-interface-custom-location.json ├── network-interface-custom-named-signal.json ├── network-interface-custom-someip.json ├── network-interface-custom-uds-dtc.json ├── network-interface-obd.json ├── network-interface-ros2.json ├── nuke-fw.sh ├── obd-decoders.json ├── obd-nodes.json ├── request-forward.sh ├── ros2-config.json ├── ros2-to-decoders.py ├── ros2-to-nodes.py ├── timestream-to-html.py ├── timestream-to-mdf.py ├── vehicle-node.json └── vision_system_data_serializer.py ├── code_check └── compile_db_remove_test.py ├── configure-fwe.sh ├── container ├── Dockerfile ├── README.md └── start-fwe.sh ├── deploy ├── fwe@.service ├── run-fwe.sh ├── start-and-enable-fwe.sh └── stop-fwe.sh ├── greengrassV2 ├── .gitignore ├── README.md └── recipes │ ├── com.amazon.aws.IoTFleetWise-1.0.0.json │ └── com.amazon.aws.IoTFleetWise-2.0.0.json ├── install-cansim.sh ├── install-deps-cross-android.sh ├── install-deps-cross-arm64.sh ├── install-deps-cross-armhf.sh ├── install-deps-native.sh ├── install-deps-versions.sh ├── install-deps-yocto.sh ├── install-fwe.sh ├── install-rossim.sh ├── install-socketcan.sh ├── patches ├── capicxx_core_runtime_allow_static_libs.patch ├── capicxx_someip_runtime_allow_static_libs.patch └── vsomeip_allow_static_libs_fix_shutdown_segfaults.patch ├── provision.sh ├── renesas-rcar-s4 └── make-rootfs.sh ├── requirements-unit-test.txt ├── rossim ├── README.md ├── config.json ├── rosigen.py ├── rossim.service ├── run-rossim.sh └── vals_default.json ├── setup-yocto-s32g.sh ├── someip_device_shadow_editor ├── .gitignore ├── README.md ├── commonapi-config.ini ├── linker.lds ├── someip_device_shadow_editor.cmake ├── someip_device_shadow_editor_repl.py ├── someip_device_shadow_editor_sim.py ├── src │ ├── DeviceShadowOverSomeipExampleApplication.cpp │ ├── DeviceShadowOverSomeipExampleApplication.hpp │ └── bindings.cpp └── vsomeip-config.json ├── someipigen ├── .gitignore ├── README.md ├── commonapi-config.ini ├── linker.lds ├── signals.json ├── someipigen.cmake ├── someipigen_repl.py ├── someipsim.py ├── src │ ├── ExampleSomeipInterfaceStubImpl.cpp │ ├── ExampleSomeipInterfaceStubImpl.hpp │ ├── SignalManager.cpp │ ├── SignalManager.hpp │ └── bindings.cpp └── vsomeip-config.json ├── system-test-setup.sh ├── test-fwe.sh ├── valgrind-unit-tests-parallel.sh └── yocto ├── .gitignore ├── README.md ├── build_s32g274ardb2ubuntu └── conf │ ├── bblayers.conf │ └── local.conf └── sources └── meta-aws-iot-fleetwise ├── conf └── layer.conf ├── recipes-extended └── setup-socketcan │ ├── files │ ├── setup-socketcan.service │ └── setup-socketcan.sh │ └── setup-socketcan.bb └── recipes-kernel └── linux-s32 ├── files └── can-isotp.cfg └── linux-s32_%.bbappend /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: Microsoft 3 | IndentWidth: 4 4 | AccessModifierOffset: -4 5 | AllowShortLambdasOnASingleLine: Empty 6 | AlwaysBreakAfterReturnType: AllDefinitions 7 | AlwaysBreakTemplateDeclarations: Yes 8 | BreakConstructorInitializers: BeforeComma 9 | BinPackArguments: false 10 | BinPackParameters: false 11 | NamespaceIndentation: None 12 | SpaceAfterCStyleCast: false 13 | SpaceAfterLogicalNot: false 14 | SpaceAfterTemplateKeyword: true 15 | SpaceBeforeAssignmentOperators: true 16 | SpaceBeforeCpp11BracedList: false 17 | SpaceBeforeCtorInitializerColon: true 18 | SpaceBeforeInheritanceColon: true 19 | SpaceBeforeParens: ControlStatements 20 | SpaceBeforeRangeBasedForLoopColon: true 21 | SpaceInEmptyBlock: false 22 | SpaceInEmptyParentheses: false 23 | SpacesBeforeTrailingComments: 1 24 | SpacesInAngles: false 25 | SpacesInContainerLiterals: true 26 | SpacesInCStyleCastParentheses: false 27 | SpacesInParentheses: true 28 | SpacesInSquareBrackets: false 29 | SpaceBeforeSquareBrackets: false 30 | UseTab: Never 31 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 100 3 | ignore = 4 | E203, # not pep8, black adds whitespace before ':' 5 | W503, # not pep8, black adds line break before binary operator 6 | PT004, 7 | PT005, 8 | pytest-fixture-no-parentheses = true 9 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # Format most files with black and prettier 2 | 5048591323cd5aac93af69d0d2b4e359be33b9a3 3 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Global owners 2 | * @aws/aws-iot-automotive 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | Note: If you discover a potential security issue in this project we ask that you notify AWS/Amazon 14 | Security via our vulnerability reporting page. Please do not create a public github issue. 15 | 16 | **To Reproduce** 17 | Steps to reproduce the behavior. 18 | 19 | **Expected behavior** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **Logs** 23 | Please attach the log output if available. 24 | 25 | **Environment (please complete the following information):** 26 | - OS: [e.g. Linux kernel version] 27 | - Version [e.g. v0.1.0] 28 | 29 | **Additional context** 30 | Add any other context about the problem here. 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. 2 | -------------------------------------------------------------------------------- /.github/template/docker-build/action.yml: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | name: Build Docker 5 | 6 | inputs: 7 | dist-name: 8 | required: true 9 | push-role: 10 | required: true 11 | 12 | runs: 13 | using: "composite" 14 | steps: 15 | - uses: docker/setup-qemu-action@v3 16 | - uses: docker/setup-buildx-action@v3 17 | - uses: aws-actions/configure-aws-credentials@v4 18 | if: 19 | github.repository == 'aws/aws-iot-fleetwise-edge' && (github.ref_type == 'tag' || github.ref 20 | == 'refs/heads/main') 21 | with: 22 | role-to-assume: ${{ inputs.push-role }} 23 | aws-region: us-east-1 24 | - uses: aws-actions/amazon-ecr-login@v2 25 | if: 26 | github.repository == 'aws/aws-iot-fleetwise-edge' && (github.ref_type == 'tag' || github.ref 27 | == 'refs/heads/main') 28 | with: 29 | registry-type: public 30 | - id: meta 31 | uses: docker/metadata-action@v5 32 | with: 33 | images: public.ecr.aws/aws-iot-fleetwise-edge/${{ inputs.dist-name }} 34 | - uses: docker/build-push-action@v5 35 | with: 36 | context: . 37 | file: "./tools/container/Dockerfile" 38 | push: 39 | ${{ github.repository == 'aws/aws-iot-fleetwise-edge' && ( github.ref_type == 'tag' || 40 | github.ref == 'refs/heads/main' ) }} 41 | tags: ${{ steps.meta.outputs.tags }} 42 | labels: ${{ steps.meta.outputs.labels }} 43 | platforms: linux/amd64,linux/arm64,linux/arm/v7 44 | build-args: DIST_NAME=${{ inputs.dist-name }} 45 | cache-from: type=gha 46 | cache-to: type=gha,mode=max 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .DS_Store 3 | .idea/ 4 | .vscode/ 5 | __pycache__/ 6 | build*/ 7 | compile_commands.json 8 | install*/ 9 | log/ 10 | .ipynb_checkpoints 11 | .cache 12 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # prose wrap option should not be used in GitHub comments: 2 | # https://prettier.io/docs/en/options.html#prose-wrap 3 | .github/ISSUE_TEMPLATE 4 | .github/PULL_REQUEST_TEMPLATE.md 5 | 6 | # manually formatted json to visually align the properties 7 | obd_config*.json 8 | 9 | # prettier thinks it is a markdown file 10 | .git-blame-ignore-revs 11 | -------------------------------------------------------------------------------- /.prettierrc.yaml: -------------------------------------------------------------------------------- 1 | printWidth: 100 2 | proseWrap: "always" 3 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | 3 | This project has adopted the 4 | [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). For more information 5 | see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 6 | opensource-codeofconduct@amazon.com with any additional questions or comments. 7 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | AWS IoT FleetWise 2 | Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | ## Reporting a Vulnerability 2 | 3 | If you discover a potential security issue in this project, we ask that you notify AWS/Amazon 4 | Security via our 5 | [vulnerability reporting page](https://aws.amazon.com/security/vulnerability-reporting/) or directly 6 | via email to aws-security@amazon.com. 7 | -------------------------------------------------------------------------------- /cmake/AwsIotFweConfig.cmake.in: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | 3 | @PACKAGE_INIT@ 4 | 5 | if(@FWE_STATIC_LINK@) 6 | set(Boost_USE_STATIC_LIBS ON) 7 | find_dependency(Boost REQUIRED COMPONENTS @REQUIRED_BOOST_COMPONENTS@) 8 | find_dependency(AWSSDK REQUIRED COMPONENTS @REQUIRED_AWS_SDK_COMPONENTS@) 9 | find_dependency(ZLIB REQUIRED) 10 | if(@FWE_FEATURE_STORE_AND_FORWARD@) 11 | list(APPEND CMAKE_PREFIX_PATH "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/cmake/aws") 12 | find_dependency(aws-store REQUIRED) 13 | endif() 14 | endif() 15 | 16 | if(NOT TARGET aws-iot-fleetwise-edge) 17 | include("${CMAKE_CURRENT_LIST_DIR}/AwsIotFweTargets.cmake") 18 | endif() 19 | 20 | set(AwsIotFwe_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@") 21 | -------------------------------------------------------------------------------- /cmake/capicxx_gen_log4j_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cmake/clang_tidy.cmake: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | if(FWE_TEST_CLANG_TIDY) 3 | find_program(CLANG_TIDY_COMMAND NAMES clang-tidy) 4 | 5 | if(NOT CLANG_TIDY_COMMAND) 6 | message(WARNING "FWE_TEST_CLANG_TIDY is ON but clang-tidy is not found!") 7 | else() 8 | add_test(NAME ClangTidyTest 9 | COMMAND bash -c "python3 ${CMAKE_CURRENT_LIST_DIR}/../tools/code_check/compile_db_remove_test.py ${CMAKE_BINARY_DIR} \ 10 | && run-clang-tidy-12 -header-filter=${CMAKE_CURRENT_SOURCE_DIR}/src/.* -p ${CMAKE_BINARY_DIR}/Testing/Temporary ${CMAKE_CURRENT_SOURCE_DIR}/src" 11 | ) 12 | endif() 13 | endif() 14 | -------------------------------------------------------------------------------- /cmake/graphviz.cmake: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | set(GRAPHVIZ_IGNORE_TARGETS "Gtest;Test;fuzz") 4 | -------------------------------------------------------------------------------- /cmake/micropython.cmake: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | if(NOT MICROPYTHON_PATH) 4 | set(MICROPYTHON_PATH ${CMAKE_SYSTEM_PREFIX_PATH}) 5 | endif() 6 | 7 | find_path(MICROPYTHON_TOP 8 | "ports/embed/port/micropython_embed.h" 9 | PATH_SUFFIXES "src/micropython" 10 | HINTS ${MICROPYTHON_PATH}) 11 | 12 | if(NOT MICROPYTHON_TOP) 13 | message(FATAL_ERROR "Could not find MicroPython source - specify with MICROPYTHON_PATH") 14 | endif() 15 | 16 | message(STATUS "Found MicroPython source: ${MICROPYTHON_TOP}") 17 | 18 | message(STATUS "Generating MicroPython embed") 19 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/micropython) 20 | execute_process( 21 | COMMAND bash -c "cp ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/micropython/* . \ 22 | && make MICROPYTHON_TOP=${MICROPYTHON_TOP} QSTR_DEFS=qstrdefsport.h -f micropython_embed.mk \ 23 | && cp ${MICROPYTHON_TOP}/extmod/modjson.c micropython_embed/extmod" 24 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/micropython 25 | RESULT_VARIABLE ret 26 | ) 27 | if(NOT ret EQUAL 0) 28 | message(FATAL_ERROR "Error generating MicroPython embed") 29 | endif() 30 | 31 | file(GLOB_RECURSE MICROPYTHON_SRC 32 | ${CMAKE_CURRENT_BINARY_DIR}/micropython/micropython_embed/*.c) 33 | 34 | add_library(micropython_embed 35 | ${MICROPYTHON_SRC} 36 | ${CMAKE_CURRENT_BINARY_DIR}/micropython/micropython_config.c) 37 | 38 | set(MICROPYTHON_INCLUDE_DIRS 39 | ${CMAKE_CURRENT_BINARY_DIR}/micropython 40 | ${CMAKE_CURRENT_BINARY_DIR}/micropython/micropython_embed 41 | ${CMAKE_CURRENT_BINARY_DIR}/micropython/micropython_embed/port 42 | ) 43 | target_include_directories(micropython_embed PUBLIC 44 | ${MICROPYTHON_INCLUDE_DIRS}) 45 | 46 | target_compile_options(micropython_embed PRIVATE -Wno-conversion -Wno-extra -Wno-pedantic) 47 | -------------------------------------------------------------------------------- /cmake/valgrind.cmake: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | if(FWE_VALGRIND) 4 | find_program(VALGRIND_COMMAND valgrind) 5 | if(NOT VALGRIND_COMMAND) 6 | message(FATAL_ERROR "valgrind is not installed") 7 | endif() 8 | set(VALGRIND_FULL_COMMAND ${VALGRIND_COMMAND} --error-exitcode=1 --max-threads=2000 --leak-check=full --show-leak-kinds=all --gen-suppressions=all --suppressions=${CMAKE_CURRENT_SOURCE_DIR}/test/unit/support/valgrind.supp) 9 | endif() 10 | 11 | function(add_valgrind_tests) 12 | if(FWE_VALGRIND) 13 | foreach(BINARY ${ARGN}) 14 | set(TEST_NAME valgrind_${BINARY}) 15 | add_test(NAME ${TEST_NAME} 16 | COMMAND ${VALGRIND_FULL_COMMAND} ./${BINARY} --gtest_output=xml:report-${TEST_NAME}.xml) 17 | endforeach() 18 | endif() 19 | endfunction() 20 | 21 | function(add_parallel_valgrind_tests) 22 | if(FWE_VALGRIND) 23 | list(JOIN VALGRIND_FULL_COMMAND " " VALGRIND_FULL_COMMAND_AS_STRING) 24 | foreach(BINARY ${ARGN}) 25 | set(TEST_NAME valgrind_${BINARY}) 26 | add_test(NAME ${TEST_NAME} 27 | COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/valgrind-unit-tests-parallel.sh --binary ${BINARY} --valgrind-command ${VALGRIND_FULL_COMMAND_AS_STRING}) 28 | endforeach() 29 | endif() 30 | endfunction() 31 | -------------------------------------------------------------------------------- /dependencies/micropython/micropython_config.c: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | #include 4 | #include 5 | 6 | mp_import_stat_t 7 | mp_import_stat( const char *path ) 8 | { 9 | struct stat st; 10 | if ( stat( path, &st ) == 0 ) 11 | { 12 | if ( ( st.st_mode & S_IFMT ) == S_IFDIR ) 13 | { 14 | return MP_IMPORT_STAT_DIR; 15 | } 16 | if ( ( st.st_mode & S_IFMT ) == S_IFREG ) 17 | { 18 | return MP_IMPORT_STAT_FILE; 19 | } 20 | } 21 | return MP_IMPORT_STAT_NO_EXIST; 22 | } 23 | 24 | // Currently no filesystem access is allowed from within scripts: 25 | mp_obj_t 26 | mp_builtin_open( size_t n_args, const mp_obj_t *args, mp_map_t *kwargs ) 27 | { 28 | return mp_const_none; 29 | } 30 | MP_DEFINE_CONST_FUN_OBJ_KW( mp_builtin_open_obj, 1, mp_builtin_open ); 31 | -------------------------------------------------------------------------------- /dependencies/micropython/micropython_embed.mk: -------------------------------------------------------------------------------- 1 | include $(MICROPYTHON_TOP)/extmod/extmod.mk 2 | include $(MICROPYTHON_TOP)/ports/embed/embed.mk 3 | -------------------------------------------------------------------------------- /dependencies/micropython/mpconfigport.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | // Include common MicroPython embed configuration. 4 | #include 5 | 6 | // clang-format off 7 | 8 | // Use the minimal starting configuration (disables all optional features). 9 | #define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_MINIMUM) 10 | 11 | // MicroPython configuration. 12 | #define MICROPY_ENABLE_COMPILER (1) 13 | #define MICROPY_ENABLE_GC (1) 14 | #define MICROPY_PY_GC (1) 15 | #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_DETAILED) 16 | #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE) 17 | #define MICROPY_PY_JSON (1) 18 | #define MICROPY_PY_IO (1) 19 | #define MICROPY_ENABLE_SOURCE_LINE (1) 20 | #define MICROPY_ENABLE_EXTERNAL_IMPORT (1) 21 | #define MICROPY_ENABLE_FINALISER (1) 22 | #define MICROPY_READER_POSIX (1) 23 | #define MICROPY_PY_SYS (1) 24 | #define MICROPY_PY_SYS_PATH (1) 25 | #define MICROPY_PY_SYS_PLATFORM "fwe" 26 | #define MICROPY_QSTR_BYTES_IN_LEN (2) 27 | 28 | // clang-format on 29 | -------------------------------------------------------------------------------- /dependencies/micropython/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | // This file defines port-specific MicroPython 'Q' strings, which are constant strings represented 4 | // by ID numbers that are generated at build time. The IDs are available in the code with the prefix 5 | // 'MP_QSTR_', e.g. 'MP_QSTR_invoke'. 6 | 7 | // clang-format off 8 | 9 | Q(invoke) 10 | Q(cleanup) 11 | 12 | // clang-format on 13 | -------------------------------------------------------------------------------- /docs/AWS-IoTFleetWiseOffboarding.md: -------------------------------------------------------------------------------- 1 | ## Offboarding and Data Deletion 2 | 3 | To delete all of your "free text data" from an ECU running the Reference Implementation for AWS IoT 4 | FleetWise ("FWE"), please run the following commands: 5 | 6 | 1. Stop FWE 7 | 8 | ```bash 9 | sudo systemctl stop fwe@0 10 | ``` 11 | 12 | 2. Disable FWE 13 | 14 | ```bash 15 | sudo systemctl disable fwe@0 16 | ``` 17 | 18 | 3. Delete the persistent data files for FWE 19 | 20 | ```bash 21 | sudo rm -f /var/aws-iot-fleetwise/* 22 | ``` 23 | 24 | 4. Delete the configuration files for FWE 25 | 26 | ```bash 27 | sudo rm -f /etc/aws-iot-fleetwise/* 28 | ``` 29 | -------------------------------------------------------------------------------- /docs/dev-guide/images/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/architecture.png -------------------------------------------------------------------------------- /docs/dev-guide/images/can-over-someip-demo-diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/can-over-someip-demo-diagram.jpg -------------------------------------------------------------------------------- /docs/dev-guide/images/collected_data_plot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/collected_data_plot.png -------------------------------------------------------------------------------- /docs/dev-guide/images/collected_data_plot_someip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/collected_data_plot_someip.png -------------------------------------------------------------------------------- /docs/dev-guide/images/last-known-state-diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/last-known-state-diagram.jpg -------------------------------------------------------------------------------- /docs/dev-guide/images/rcar-s4-spider.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/rcar-s4-spider.jpg -------------------------------------------------------------------------------- /docs/dev-guide/images/s32g_golden_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/s32g_golden_box.png -------------------------------------------------------------------------------- /docs/dev-guide/images/snf-forwarding-data-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/snf-forwarding-data-diagram.png -------------------------------------------------------------------------------- /docs/dev-guide/images/snf-high-level-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/snf-high-level-diagram.png -------------------------------------------------------------------------------- /docs/dev-guide/images/snf-storing-data-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/snf-storing-data-diagram.png -------------------------------------------------------------------------------- /docs/dev-guide/images/snf-stream-management-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/snf-stream-management-diagram.png -------------------------------------------------------------------------------- /docs/dev-guide/images/someip-collection-diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/someip-collection-diagram.jpg -------------------------------------------------------------------------------- /docs/dev-guide/images/someip-commands-diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/someip-commands-diagram.jpg -------------------------------------------------------------------------------- /docs/dev-guide/images/uds-dtc-architecture-uml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/images/uds-dtc-architecture-uml.png -------------------------------------------------------------------------------- /docs/dev-guide/vision-system-data/data/campaign-brake-event-vision-system-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "diagnosticsMode": "OFF", 4 | "spoolingMode": "TO_DISK", 5 | "collectionScheme": { 6 | "conditionBasedCollectionScheme": { 7 | "conditionLanguageVersion": 1, 8 | "expression": "$variable.`Vehicle.Acceleration.linear_acceleration.x` < -100", 9 | "minimumTriggerIntervalMs": 1000, 10 | "triggerMode": "ALWAYS" 11 | } 12 | }, 13 | "postTriggerCollectionDuration": 1000, 14 | "signalsToCollect": [ 15 | { 16 | "name": "Vehicle.Cameras.Front.Image" 17 | }, 18 | { 19 | "name": "Vehicle.Speed" 20 | }, 21 | { 22 | "name": "Vehicle.Airbag.CollisionIntensity" 23 | }, 24 | { 25 | "name": "Vehicle.Acceleration" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /docs/dev-guide/vision-system-data/data/campaign-vision-system-data-heartbeat.json: -------------------------------------------------------------------------------- 1 | { 2 | "spoolingMode": "TO_DISK", 3 | "collectionScheme": { 4 | "timeBasedCollectionScheme": { 5 | "periodMs": 10000 6 | } 7 | }, 8 | "signalsToCollect": [ 9 | { 10 | "name": "Vehicle.Cameras.Front.Image", 11 | "maxSampleCount": 1 12 | }, 13 | { 14 | "name": "Vehicle.Speed", 15 | "maxSampleCount": 10, 16 | "minimumSamplingIntervalMs": 1000 17 | }, 18 | { 19 | "name": "Vehicle.Airbag.CollisionIntensity", 20 | "maxSampleCount": 10, 21 | "minimumSamplingIntervalMs": 1000 22 | }, 23 | { 24 | "name": "Vehicle.Acceleration", 25 | "maxSampleCount": 10, 26 | "minimumSamplingIntervalMs": 1000 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /docs/dev-guide/vision-system-data/data/network-interfaces.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "10", 4 | "type": "VEHICLE_MIDDLEWARE", 5 | "vehicleMiddleware": { 6 | "name": "ros2", 7 | "protocolName": "ROS_2" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /docs/dev-guide/vision-system-data/data/ros2-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "messages": [ 3 | { 4 | "fullyQualifiedName": "Vehicle.Cameras.Front.Image", 5 | "interfaceId": "10", 6 | "topic": "/carla/ego_vehicle/rgb_front/image_compressed", 7 | "type": "sensor_msgs/msg/CompressedImage" 8 | }, 9 | { 10 | "fullyQualifiedName": "Vehicle.Speed", 11 | "interfaceId": "10", 12 | "topic": "/carla/ego_vehicle/speedometer", 13 | "type": "std_msgs/msg/Float32" 14 | }, 15 | { 16 | "fullyQualifiedName": "Vehicle.Airbag.CollisionIntensity", 17 | "interfaceId": "10", 18 | "topic": "/carla/ego_vehicle/collision_intensity", 19 | "type": "std_msgs/msg/Float32" 20 | }, 21 | { 22 | "fullyQualifiedName": "Vehicle.Acceleration", 23 | "interfaceId": "10", 24 | "topic": "/carla/ego_vehicle/imu", 25 | "type": "sensor_msgs/msg/Imu" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /docs/dev-guide/vision-system-data/foxglove-studio-screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/vision-system-data/foxglove-studio-screenshot.jpg -------------------------------------------------------------------------------- /docs/dev-guide/vision-system-data/vision-system-data-demo-diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/dev-guide/vision-system-data/vision-system-data-demo-diagram.jpg -------------------------------------------------------------------------------- /docs/iot-FleetWise-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/iot-FleetWise-architecture.png -------------------------------------------------------------------------------- /docs/iwave-g26-tutorial/obd-port-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/iwave-g26-tutorial/obd-port-1.jpg -------------------------------------------------------------------------------- /docs/iwave-g26-tutorial/obd-port-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/docs/iwave-g26-tutorial/obd-port-2.jpg -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | cmake_minimum_required(VERSION 3.10.2) 4 | 5 | project(fwe-examples) 6 | 7 | add_subdirectory(custom_function) 8 | add_subdirectory(mqtt_pub_sub) 9 | add_subdirectory(network_agnostic_actuator_commands) 10 | add_subdirectory(network_agnostic_data_collection) 11 | add_subdirectory(s3_upload) 12 | add_subdirectory(someip) 13 | -------------------------------------------------------------------------------- /examples/custom_function/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | cmake_minimum_required(VERSION 3.10.2) 4 | 5 | project(fwe-example-custom-function) 6 | 7 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 8 | 9 | # Dependencies 10 | find_package(AwsIotFwe REQUIRED) 11 | 12 | add_executable(fwe-example-custom-function 13 | CustomFunctionCounter.cpp 14 | CustomFunctionFileSize.cpp 15 | CustomFunctionSin.cpp 16 | main.cpp 17 | ) 18 | target_include_directories(fwe-example-custom-function PUBLIC 19 | ${AwsIotFwe_INCLUDE_DIR} 20 | ) 21 | target_link_libraries(fwe-example-custom-function 22 | AwsIotFwe::aws-iot-fleetwise-edge 23 | ) 24 | -------------------------------------------------------------------------------- /examples/custom_function/CustomFunctionCounter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "CustomFunctionCounter.h" 5 | #include 6 | 7 | Aws::IoTFleetWise::CustomFunctionInvokeResult 8 | CustomFunctionCounter::invoke( Aws::IoTFleetWise::CustomFunctionInvocationID invocationId, 9 | const std::vector &args ) 10 | { 11 | static_cast( args ); 12 | // Create a new counter if the invocationId is new, or get the existing counter: 13 | auto &counter = mCounters.emplace( invocationId, 0 ).first->second; 14 | return { Aws::IoTFleetWise::ExpressionErrorCode::SUCCESSFUL, counter++ }; 15 | } 16 | 17 | void 18 | CustomFunctionCounter::cleanup( Aws::IoTFleetWise::CustomFunctionInvocationID invocationId ) 19 | { 20 | mCounters.erase( invocationId ); 21 | } 22 | -------------------------------------------------------------------------------- /examples/custom_function/CustomFunctionCounter.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | class CustomFunctionCounter 11 | { 12 | public: 13 | Aws::IoTFleetWise::CustomFunctionInvokeResult invoke( Aws::IoTFleetWise::CustomFunctionInvocationID invocationId, 14 | const std::vector &args ); 15 | void cleanup( Aws::IoTFleetWise::CustomFunctionInvocationID invocationId ); 16 | 17 | private: 18 | std::unordered_map mCounters; 19 | }; 20 | -------------------------------------------------------------------------------- /examples/custom_function/CustomFunctionFileSize.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class CustomFunctionFileSize 15 | { 16 | public: 17 | CustomFunctionFileSize( std::shared_ptr namedSignalDataSource ); 18 | Aws::IoTFleetWise::CustomFunctionInvokeResult invoke( Aws::IoTFleetWise::CustomFunctionInvocationID invocationId, 19 | const std::vector &args ); 20 | void conditionEnd( const std::unordered_set &collectedSignalIds, 21 | Aws::IoTFleetWise::Timestamp timestamp, 22 | Aws::IoTFleetWise::CollectionInspectionEngineOutput &output ); 23 | 24 | private: 25 | std::shared_ptr mNamedSignalDataSource; 26 | int mFileSize{ -1 }; 27 | }; 28 | -------------------------------------------------------------------------------- /examples/custom_function/CustomFunctionSin.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | #include "CustomFunctionSin.h" 6 | #include 7 | 8 | Aws::IoTFleetWise::CustomFunctionInvokeResult 9 | customFunctionSin( Aws::IoTFleetWise::CustomFunctionInvocationID invocationId, 10 | const std::vector &args ) 11 | { 12 | static_cast( invocationId ); 13 | if ( args.size() != 1 ) 14 | { 15 | return Aws::IoTFleetWise::ExpressionErrorCode::TYPE_MISMATCH; 16 | } 17 | if ( args[0].isUndefined() ) 18 | { 19 | return Aws::IoTFleetWise::ExpressionErrorCode::SUCCESSFUL; // Undefined result 20 | } 21 | if ( !args[0].isBoolOrDouble() ) 22 | { 23 | return Aws::IoTFleetWise::ExpressionErrorCode::TYPE_MISMATCH; 24 | } 25 | return { Aws::IoTFleetWise::ExpressionErrorCode::SUCCESSFUL, std::sin( args[0].asDouble() ) }; 26 | } 27 | -------------------------------------------------------------------------------- /examples/custom_function/CustomFunctionSin.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | Aws::IoTFleetWise::CustomFunctionInvokeResult customFunctionSin( 11 | Aws::IoTFleetWise::CustomFunctionInvocationID invocationId, 12 | const std::vector &args ); 13 | -------------------------------------------------------------------------------- /examples/custom_function/campaign-counter.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "collectionScheme": { 4 | "conditionBasedCollectionScheme": { 5 | "conditionLanguageVersion": 1, 6 | "expression": "custom_function('counter') < 1000", 7 | "minimumTriggerIntervalMs": 1000, 8 | "triggerMode": "ALWAYS" 9 | } 10 | }, 11 | "signalsToCollect": [ 12 | { 13 | "name": "Vehicle.ABS.DemoBrakePedalPressure" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /examples/custom_function/campaign-file-size.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "collectionScheme": { 4 | "conditionBasedCollectionScheme": { 5 | "conditionLanguageVersion": 1, 6 | "expression": "custom_function('file_size', '/tmp/fwe_test_file') > 10", 7 | "minimumTriggerIntervalMs": 1000, 8 | "triggerMode": "ALWAYS" 9 | } 10 | }, 11 | "signalsToCollect": [ 12 | { 13 | "name": "Vehicle.FileSize" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /examples/custom_function/campaign-sin.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "collectionScheme": { 4 | "conditionBasedCollectionScheme": { 5 | "conditionLanguageVersion": 1, 6 | "expression": "custom_function('sin', $variable.`Vehicle.ABS.DemoBrakePedalPressure` / $variable.`Vehicle.ECM.DemoEngineTorque`) > 0.5", 7 | "triggerMode": "RISING_EDGE" 8 | } 9 | }, 10 | "signalsToCollect": [ 11 | { 12 | "name": "Vehicle.ABS.DemoBrakePedalPressure" 13 | }, 14 | { 15 | "name": "Vehicle.ECM.DemoEngineTorque" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/custom_function/custom-decoders-file-size.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.FileSize", 4 | "interfaceId": "NAMED_SIGNAL", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "Vehicle.FileSize" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /examples/custom_function/custom-nodes-file-size.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "branch": { 4 | "fullyQualifiedName": "Vehicle", 5 | "description": "Vehicle" 6 | } 7 | }, 8 | { 9 | "sensor": { 10 | "fullyQualifiedName": "Vehicle.FileSize", 11 | "description": "Vehicle.FileSize", 12 | "dataType": "DOUBLE" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /examples/mqtt_pub_sub/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | cmake_minimum_required(VERSION 3.10.2) 4 | 5 | project(fwe-example-mqtt-pub-sub) 6 | 7 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 8 | 9 | find_package(AwsIotFwe REQUIRED) 10 | 11 | add_executable(fwe-example-mqtt-pub-sub 12 | main.cpp 13 | ) 14 | target_include_directories(fwe-example-mqtt-pub-sub PUBLIC 15 | ${AwsIotFwe_INCLUDE_DIR} 16 | ) 17 | target_link_libraries(fwe-example-mqtt-pub-sub 18 | AwsIotFwe::aws-iot-fleetwise-edge 19 | ) 20 | -------------------------------------------------------------------------------- /examples/network_agnostic_actuator_commands/AcCommandDispatcher.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "AcCommandDispatcher.h" 5 | #include 6 | #include 7 | 8 | AcCommandDispatcher::AcCommandDispatcher() 9 | { 10 | } 11 | 12 | bool 13 | AcCommandDispatcher::init() 14 | { 15 | return true; 16 | } 17 | 18 | void 19 | AcCommandDispatcher::setActuatorValue( const std::string &actuatorName, 20 | const Aws::IoTFleetWise::SignalValueWrapper &signalValue, 21 | const Aws::IoTFleetWise::CommandID &commandId, 22 | Aws::IoTFleetWise::Timestamp issuedTimestampMs, 23 | Aws::IoTFleetWise::Timestamp executionTimeoutMs, 24 | Aws::IoTFleetWise::NotifyCommandStatusCallback notifyStatusCallback ) 25 | { 26 | // Here invoke your actuation 27 | FWE_LOG_INFO( "Actuator " + actuatorName + " executed successfully for command ID " + commandId ); 28 | notifyStatusCallback( Aws::IoTFleetWise::CommandStatus::SUCCEEDED, 0x1234, "Success" ); 29 | } 30 | 31 | std::vector 32 | AcCommandDispatcher::getActuatorNames() 33 | { 34 | return { "Vehicle.ActivateAC" }; 35 | } 36 | -------------------------------------------------------------------------------- /examples/network_agnostic_actuator_commands/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | cmake_minimum_required(VERSION 3.10.2) 4 | 5 | project(fwe-example-network-agnostic-actuator-commands) 6 | 7 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 8 | 9 | find_package(AwsIotFwe REQUIRED) 10 | 11 | add_executable(fwe-example-network-agnostic-actuator-commands 12 | AcCommandDispatcher.cpp 13 | main.cpp 14 | ) 15 | target_include_directories(fwe-example-network-agnostic-actuator-commands PUBLIC 16 | ${AwsIotFwe_INCLUDE_DIR} 17 | ) 18 | target_link_libraries(fwe-example-network-agnostic-actuator-commands 19 | AwsIotFwe::aws-iot-fleetwise-edge 20 | ) 21 | -------------------------------------------------------------------------------- /examples/network_agnostic_actuator_commands/custom-decoders-ac-actuators.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.ActivateAC", 4 | "interfaceId": "AC_ACTUATORS", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "Vehicle.ActivateAC" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /examples/network_agnostic_actuator_commands/custom-nodes-ac-actuators.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "branch": { 4 | "fullyQualifiedName": "Vehicle", 5 | "description": "Vehicle" 6 | } 7 | }, 8 | { 9 | "actuator": { 10 | "fullyQualifiedName": "Vehicle.ActivateAC", 11 | "description": "Vehicle.ActivateAC", 12 | "dataType": "BOOLEAN" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /examples/network_agnostic_actuator_commands/network-interface-custom-ac-actuators.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "AC_ACTUATORS", 4 | "type": "CUSTOM_DECODING_INTERFACE", 5 | "customDecodingInterface": { 6 | "name": "NamedSignalInterface" 7 | } 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /examples/network_agnostic_data_collection/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | cmake_minimum_required(VERSION 3.10.2) 4 | 5 | project(fwe-example-network-agnostic-data-collection) 6 | 7 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 8 | 9 | find_package(AwsIotFwe REQUIRED) 10 | 11 | add_executable(fwe-example-network-agnostic-data-collection 12 | MyCustomDataSource.cpp 13 | MyCounterDataSource.cpp 14 | main.cpp 15 | ) 16 | target_include_directories(fwe-example-network-agnostic-data-collection PUBLIC 17 | ${AwsIotFwe_INCLUDE_DIR} 18 | ) 19 | target_link_libraries(fwe-example-network-agnostic-data-collection 20 | AwsIotFwe::aws-iot-fleetwise-edge 21 | ) 22 | -------------------------------------------------------------------------------- /examples/network_agnostic_data_collection/MyCounterDataSource.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | class MyCounterDataSource 16 | { 17 | public: 18 | static constexpr const char *CONFIG_OPTION_1 = "myOption1"; 19 | static constexpr const char *SIGNAL_NAME = "Vehicle.MyCounter"; 20 | 21 | MyCounterDataSource( std::shared_ptr namedSignalDataSource, 22 | uint32_t configOption1, 23 | Aws::IoTFleetWise::RawData::BufferManager *rawDataBufferManager ); 24 | 25 | ~MyCounterDataSource(); 26 | 27 | private: 28 | std::shared_ptr mNamedSignalDataSource; 29 | uint32_t mConfigOption1; 30 | std::shared_ptr mClock = Aws::IoTFleetWise::ClockHandler::getClock(); 31 | Aws::IoTFleetWise::RawData::BufferManager *mRawDataBufferManager; 32 | uint32_t mCounter{}; 33 | std::thread mThread; 34 | std::atomic_bool mThreadShouldStop{ false }; 35 | }; 36 | -------------------------------------------------------------------------------- /examples/network_agnostic_data_collection/campaign-nadc-example-heartbeat.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "collectionScheme": { 4 | "timeBasedCollectionScheme": { 5 | "periodMs": 10000 6 | } 7 | }, 8 | "signalsToCollect": [ 9 | { 10 | "name": "Vehicle.CurrentLocation.Latitude" 11 | }, 12 | { 13 | "name": "Vehicle.CurrentLocation.Longitude" 14 | }, 15 | { 16 | "name": "Vehicle.MyCounter" 17 | }, 18 | { 19 | "name": "Vehicle.MyCustom" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /examples/network_agnostic_data_collection/custom-decoders-my-counter.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.MyCounter", 4 | "interfaceId": "MY_COUNTER", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "Vehicle.MyCounter" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /examples/network_agnostic_data_collection/custom-decoders-my-custom.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.MyCustom", 4 | "interfaceId": "MY_CUSTOM", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "123:456:789" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /examples/network_agnostic_data_collection/custom-decoders-my-location.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.CurrentLocation.Longitude", 4 | "interfaceId": "NAMED_SIGNAL", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "Vehicle.CurrentLocation.Longitude" 8 | } 9 | }, 10 | { 11 | "fullyQualifiedName": "Vehicle.CurrentLocation.Latitude", 12 | "interfaceId": "NAMED_SIGNAL", 13 | "type": "CUSTOM_DECODING_SIGNAL", 14 | "customDecodingSignal": { 15 | "id": "Vehicle.CurrentLocation.Latitude" 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /examples/network_agnostic_data_collection/custom-nodes-my-counter.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "branch": { 4 | "fullyQualifiedName": "Vehicle", 5 | "description": "Vehicle" 6 | } 7 | }, 8 | { 9 | "actuator": { 10 | "fullyQualifiedName": "Vehicle.MyCounter", 11 | "description": "Vehicle.MyCounter", 12 | "dataType": "STRING" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /examples/network_agnostic_data_collection/custom-nodes-my-custom.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "branch": { 4 | "fullyQualifiedName": "Vehicle", 5 | "description": "Vehicle" 6 | } 7 | }, 8 | { 9 | "actuator": { 10 | "fullyQualifiedName": "Vehicle.MyCustom", 11 | "description": "Vehicle.MyCustom", 12 | "dataType": "DOUBLE" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /examples/network_agnostic_data_collection/network-interface-custom-my-counter.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "MY_COUNTER", 4 | "type": "CUSTOM_DECODING_INTERFACE", 5 | "customDecodingInterface": { 6 | "name": "NamedSignalInterface" 7 | } 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /examples/network_agnostic_data_collection/network-interface-custom-my-custom.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "MY_CUSTOM", 4 | "type": "CUSTOM_DECODING_INTERFACE", 5 | "customDecodingInterface": { 6 | "name": "MyCustomInterface" 7 | } 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /examples/s3_upload/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | cmake_minimum_required(VERSION 3.10.2) 4 | 5 | project(fwe-example-s3-upload) 6 | 7 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 8 | 9 | find_package(AwsIotFwe REQUIRED) 10 | 11 | add_executable(fwe-example-s3-upload 12 | MyS3Upload.cpp 13 | main.cpp 14 | ) 15 | target_include_directories(fwe-example-s3-upload PUBLIC 16 | ${AwsIotFwe_INCLUDE_DIR} 17 | ) 18 | target_link_libraries(fwe-example-s3-upload 19 | AwsIotFwe::aws-iot-fleetwise-edge 20 | ) 21 | -------------------------------------------------------------------------------- /examples/s3_upload/MyS3Upload.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | class MyS3Upload 13 | { 14 | public: 15 | MyS3Upload( 16 | std::function()> createTransferManagerWrapper, 17 | std::string bucketName ); 18 | 19 | void doUpload( const std::string &localFilePath, const std::string &remoteObjectKey ); 20 | 21 | void 22 | // coverity[autosar_cpp14_a8_4_11_violation] smart pointer needed to match the expected signature 23 | transferStatusUpdatedCallback( const std::shared_ptr &transferHandle ); 24 | 25 | void 26 | // coverity[autosar_cpp14_a8_4_11_violation] smart pointer needed to match the expected signature 27 | transferErrorCallback( const std::shared_ptr &transferHandle, 28 | const Aws::Client::AWSError &error ); 29 | 30 | private: 31 | std::shared_ptr mTransferManagerWrapper; 32 | std::string mBucketName; 33 | std::function()> mCreateTransferManagerWrapper; 34 | }; 35 | -------------------------------------------------------------------------------- /examples/someip/MySomeipInterfaceWrapper.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "MySomeipInterfaceWrapper.h" 5 | #include 6 | #include 7 | 8 | MySomeipInterfaceWrapper::MySomeipInterfaceWrapper( 9 | std::string domain, 10 | std::string instance, 11 | std::string connection, 12 | std::function>( std::string, std::string, std::string )> 13 | buildProxy ) 14 | : mDomain( std::move( domain ) ) 15 | , mInstance( std::move( instance ) ) 16 | , mConnection( std::move( connection ) ) 17 | , mBuildProxy( std::move( buildProxy ) ) 18 | { 19 | } 20 | 21 | bool 22 | MySomeipInterfaceWrapper::init() 23 | { 24 | mProxy = mBuildProxy( mDomain, mInstance, mConnection ); 25 | if ( mProxy == nullptr ) 26 | { 27 | FWE_LOG_ERROR( "Failed to build proxy " ); 28 | return false; 29 | } 30 | return true; 31 | } 32 | 33 | std::shared_ptr 34 | MySomeipInterfaceWrapper::getProxy() const 35 | { 36 | return std::static_pointer_cast( mProxy ); 37 | } 38 | 39 | const std::unordered_map & 40 | MySomeipInterfaceWrapper::getSupportedActuatorInfo() const 41 | { 42 | return mSupportedActuatorInfo; 43 | } 44 | -------------------------------------------------------------------------------- /examples/someip/MySomeipInterfaceWrapper.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "v1/commonapi/MySomeipInterfaceProxy.hpp" 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class MySomeipInterfaceWrapper : public Aws::IoTFleetWise::ISomeipInterfaceWrapper 15 | { 16 | public: 17 | MySomeipInterfaceWrapper( 18 | std::string domain, 19 | std::string instance, 20 | std::string connection, 21 | std::function>( std::string, std::string, std::string )> 22 | buildProxy ); 23 | 24 | MySomeipInterfaceWrapper( const MySomeipInterfaceWrapper & ) = delete; 25 | MySomeipInterfaceWrapper &operator=( const MySomeipInterfaceWrapper & ) = delete; 26 | MySomeipInterfaceWrapper( MySomeipInterfaceWrapper && ) = delete; 27 | MySomeipInterfaceWrapper &operator=( MySomeipInterfaceWrapper && ) = delete; 28 | 29 | bool init() override; 30 | 31 | std::shared_ptr getProxy() const override; 32 | 33 | const std::unordered_map &getSupportedActuatorInfo() 34 | const override; 35 | 36 | private: 37 | std::shared_ptr> mProxy; 38 | std::string mDomain; 39 | std::string mInstance; 40 | std::string mConnection; 41 | std::function>( std::string, std::string, std::string )> 42 | mBuildProxy; 43 | std::unordered_map mSupportedActuatorInfo; 44 | }; 45 | -------------------------------------------------------------------------------- /examples/someip/campaign-my-someip-heartbeat.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "collectionScheme": { 4 | "timeBasedCollectionScheme": { 5 | "periodMs": 10000 6 | } 7 | }, 8 | "signalsToCollect": [ 9 | { 10 | "name": "Vehicle.MySomeipInterface.X" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /examples/someip/custom-decoders-my-someip.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.MySomeipInterface.X", 4 | "interfaceId": "MY_SOMEIP", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "Vehicle.MySomeipInterface.X" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /examples/someip/custom-nodes-my-someip.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "branch": { 4 | "fullyQualifiedName": "Vehicle.MySomeipInterface", 5 | "description": "Vehicle.MySomeipInterface" 6 | } 7 | }, 8 | { 9 | "sensor": { 10 | "fullyQualifiedName": "Vehicle.MySomeipInterface.X", 11 | "description": "Vehicle.MySomeipInterface.X", 12 | "dataType": "INT32" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /examples/someip/fidl/MySomeipInterface.fdepl: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-4-SOMEIP_deployment_spec.fdepl" 5 | import "MySomeipInterface.fidl" 6 | 7 | define org.genivi.commonapi.someip.deployment for interface commonapi.MySomeipInterface { 8 | SomeIpServiceID = 0x1234 9 | 10 | attribute x { 11 | SomeIpGetterID = 0x0BB8 12 | SomeIpSetterID = 0x0BB9 13 | SomeIpNotifierID = 0x80f2 14 | SomeIpNotifierEventGroups = { 0x80f2 } 15 | 16 | SomeIpAttributeReliable = false 17 | } 18 | 19 | } 20 | 21 | define org.genivi.commonapi.someip.deployment for provider as Service { 22 | instance commonapi.MySomeipInterface { 23 | InstanceId = "commonapi.MySomeipInterface" 24 | SomeIpInstanceID = 0x5678 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/someip/fidl/MySomeipInterface.fidl: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package commonapi 5 | 6 | interface MySomeipInterface { 7 | version { major 1 minor 0 } 8 | 9 | attribute Int32 x 10 | } 11 | -------------------------------------------------------------------------------- /examples/someip/network-interface-custom-my-someip.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "MY_SOMEIP", 4 | "type": "CUSTOM_DECODING_INTERFACE", 5 | "customDecodingInterface": { 6 | "name": "NamedSignalInterface" 7 | } 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/AwsBootstrap.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace Crt 13 | { 14 | namespace Io 15 | { 16 | class ClientBootstrap; 17 | } 18 | } // namespace Crt 19 | 20 | namespace IoTFleetWise 21 | { 22 | 23 | /** 24 | * This module bootstrap the AWS CRT by creating event loop and client bootstrap 25 | */ 26 | class AwsBootstrap 27 | { 28 | public: 29 | ~AwsBootstrap() = default; 30 | 31 | AwsBootstrap( const AwsBootstrap & ) = delete; 32 | AwsBootstrap &operator=( const AwsBootstrap & ) = delete; 33 | AwsBootstrap( AwsBootstrap && ) = delete; 34 | AwsBootstrap &operator=( AwsBootstrap && ) = delete; 35 | 36 | // initialization on first use (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#i3-avoid-singletons) 37 | static AwsBootstrap &getInstance( Aws::Utils::Logging::LogLevel logLevel = Aws::Utils::Logging::LogLevel::Off ); 38 | 39 | static Aws::Utils::Logging::LogLevel logLevelFromString( const std::string &logLevelStr ); 40 | 41 | /** 42 | * @brief Create eventLoopGroup, DefaultHostResolver and clientBoostrap 43 | * Note this function use std::call_once so that the all resources will be created only once 44 | * 45 | * @return raw pointer to Aws::Crt::Io::ClientBootstrap 46 | */ 47 | Aws::Crt::Io::ClientBootstrap *getClientBootStrap(); 48 | 49 | private: 50 | AwsBootstrap( Aws::Utils::Logging::LogLevel logLevel ); 51 | 52 | struct Impl; 53 | std::unique_ptr mImpl; 54 | }; 55 | 56 | } // namespace IoTFleetWise 57 | } // namespace Aws 58 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/CANDataTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/SignalTypes.h" 7 | #include "aws/iotfleetwise/TimeTypes.h" 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace IoTFleetWise 13 | { 14 | 15 | struct CANDecodedSignal 16 | { 17 | 18 | CANDecodedSignal( uint32_t signalID, DecodedSignalValue physicalValue, SignalType signalTypeIn ) 19 | : mSignalID( signalID ) 20 | , mPhysicalValue( physicalValue ) 21 | , mSignalType( signalTypeIn ) 22 | { 23 | } 24 | 25 | uint32_t mSignalID; 26 | DecodedSignalValue mPhysicalValue; 27 | SignalType mSignalType{ SignalType::UNKNOWN }; 28 | }; 29 | 30 | /** 31 | * @brief Cloud does not send information about each CAN message, so we set every CAN message size to the maximum. 32 | */ 33 | static constexpr uint8_t MAX_CAN_FRAME_BYTE_SIZE = 64; 34 | 35 | } // namespace IoTFleetWise 36 | } // namespace Aws 37 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/CANInterfaceIDTranslator.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/CollectionInspectionAPITypes.h" 7 | #include "aws/iotfleetwise/SignalTypes.h" 8 | 9 | namespace Aws 10 | { 11 | namespace IoTFleetWise 12 | { 13 | /** 14 | * @brief Translate the internal used Id to the Id used in config file and decoder manifest 15 | * Adding new items is not thread safe 16 | */ 17 | class CANInterfaceIDTranslator 18 | { 19 | 20 | public: 21 | void 22 | add( InterfaceID iid ) 23 | { 24 | mLookup.emplace_back( mCounter, iid ); 25 | mCounter++; 26 | } 27 | 28 | CANChannelNumericID 29 | getChannelNumericID( const InterfaceID &iid ) const 30 | { 31 | for ( auto l : mLookup ) 32 | { 33 | if ( l.second == iid ) 34 | { 35 | return l.first; 36 | } 37 | } 38 | return INVALID_CAN_SOURCE_NUMERIC_ID; 39 | }; 40 | 41 | InterfaceID 42 | getInterfaceID( CANChannelNumericID cid ) const 43 | { 44 | for ( auto l : mLookup ) 45 | { 46 | if ( l.first == cid ) 47 | { 48 | return l.second; 49 | } 50 | } 51 | return INVALID_INTERFACE_ID; 52 | }; 53 | 54 | private: 55 | std::vector> mLookup; 56 | CANChannelNumericID mCounter{ 0 }; 57 | }; 58 | 59 | } // namespace IoTFleetWise 60 | } // namespace Aws 61 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/ClockHandler.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/Clock.h" 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace IoTFleetWise 12 | { 13 | 14 | /** 15 | * @brief This module allows users to inject an external clock into the system. 16 | * If no clock is provided, the module will return a default clock based on Chrono. 17 | * The clock can be shared safely between modules that need time. 18 | */ 19 | class ClockHandler 20 | { 21 | public: 22 | /** 23 | * @brief Return the current clock that's available. If no clock has been set, 24 | * a default clock based on Chrono will be returned. 25 | * @return Shared clock object. 26 | */ 27 | static std::shared_ptr getClock(); 28 | 29 | /** 30 | * @brief Set an external clock to the system. Thread safe API 31 | * @param clock the new clock instance 32 | */ 33 | static void setClock( std::shared_ptr clock ); 34 | }; 35 | 36 | } // namespace IoTFleetWise 37 | } // namespace Aws 38 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/CommandResponseDataSender.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/DataSenderTypes.h" 7 | #include "aws/iotfleetwise/ISender.h" 8 | #include "command_response.pb.h" 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace IoTFleetWise 16 | { 17 | 18 | /** 19 | * @brief Sends command responses 20 | */ 21 | class CommandResponseDataSender : public DataSender 22 | { 23 | 24 | public: 25 | CommandResponseDataSender( ISender &sender ); 26 | 27 | ~CommandResponseDataSender() override = default; 28 | 29 | bool isAlive() override; 30 | 31 | /** 32 | * @brief Process command response and prepare data for upload 33 | */ 34 | void processData( const DataToSend &data, OnDataProcessedCallback callback ) override; 35 | 36 | void processPersistedData( const uint8_t *buf, 37 | size_t size, 38 | const Json::Value &metadata, 39 | OnPersistedDataProcessedCallback callback ) override; 40 | 41 | private: 42 | /** 43 | * @brief member variable used to hold the command response data and minimize heap fragmentation 44 | */ 45 | Schemas::Commands::CommandResponse mProtoCommandResponseMsg; 46 | ISender &mMqttSender; 47 | }; 48 | 49 | } // namespace IoTFleetWise 50 | } // namespace Aws 51 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/CustomFunctionMath.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/CollectionInspectionAPITypes.h" 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace IoTFleetWise 12 | { 13 | namespace CustomFunctionMath 14 | { 15 | 16 | CustomFunctionInvokeResult absFunc( CustomFunctionInvocationID invocationId, const std::vector &args ); 17 | 18 | CustomFunctionInvokeResult minFunc( CustomFunctionInvocationID invocationId, const std::vector &args ); 19 | 20 | CustomFunctionInvokeResult maxFunc( CustomFunctionInvocationID invocationId, const std::vector &args ); 21 | 22 | CustomFunctionInvokeResult powFunc( CustomFunctionInvocationID invocationId, const std::vector &args ); 23 | 24 | CustomFunctionInvokeResult logFunc( CustomFunctionInvocationID invocationId, const std::vector &args ); 25 | 26 | CustomFunctionInvokeResult ceilFunc( CustomFunctionInvocationID invocationId, 27 | const std::vector &args ); 28 | 29 | CustomFunctionInvokeResult floorFunc( CustomFunctionInvocationID invocationId, 30 | const std::vector &args ); 31 | 32 | } // namespace CustomFunctionMath 33 | } // namespace IoTFleetWise 34 | } // namespace Aws 35 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/DataSenderManager.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/DataSenderTypes.h" 7 | #include "aws/iotfleetwise/PayloadManager.h" 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace IoTFleetWise 14 | { 15 | 16 | /** 17 | * @brief Class that implements data sender logic: data preprocessing and upload 18 | * 19 | * This class is not thread-safe so the caller needs to ensure that the different functions 20 | * are called only from one thread. This class will be instantiated and used from the Data Sender 21 | * Manager Worker thread 22 | */ 23 | class DataSenderManager 24 | { 25 | 26 | public: 27 | DataSenderManager( const std::unordered_map> &dataSenders, 28 | PayloadManager *payloadManager ); 29 | 30 | virtual ~DataSenderManager() = default; 31 | 32 | /** 33 | * @brief Process collection scheme parameters and prepare data for upload 34 | */ 35 | virtual void processData( const DataToSend &data ); 36 | 37 | /** 38 | * @brief Retrieve all the persisted data and hand it over to the correct sender 39 | */ 40 | virtual void checkAndSendRetrievedData(); 41 | 42 | private: 43 | const std::unordered_map> &mDataSenders; 44 | PayloadManager *mPayloadManager; 45 | }; 46 | 47 | } // namespace IoTFleetWise 48 | } // namespace Aws 49 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/EnumUtility.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace Aws 9 | { 10 | namespace IoTFleetWise 11 | { 12 | 13 | /** 14 | * @brief Get the underlying type of an enum 15 | * 16 | * @tparam E The enumerator type 17 | * @param enumerator The enumerator value 18 | * @return The underlying type of the enumerator 19 | */ 20 | template 21 | constexpr auto 22 | toUType( E enumerator ) 23 | { 24 | return static_cast>( enumerator ); 25 | } 26 | 27 | } // namespace IoTFleetWise 28 | } // namespace Aws 29 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/EventTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace Aws 9 | { 10 | namespace IoTFleetWise 11 | { 12 | 13 | /** 14 | * @brief Identifier of Event triggered by a collectionScheme. 15 | */ 16 | using EventID = uint32_t; 17 | 18 | } // namespace IoTFleetWise 19 | } // namespace Aws 20 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/ExternalGpsSource.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | #pragma once 4 | 5 | #include "aws/iotfleetwise/NamedSignalDataSource.h" 6 | #include 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace IoTFleetWise 12 | { 13 | 14 | class ExternalGpsSource 15 | { 16 | public: 17 | /** 18 | * @param namedSignalDataSource Named signal data source 19 | * @param latitudeSignalName the signal name of the latitude signal 20 | * @param longitudeSignalName the signal name of the longitude signal 21 | */ 22 | ExternalGpsSource( std::shared_ptr namedSignalDataSource, 23 | std::string latitudeSignalName, 24 | std::string longitudeSignalName ); 25 | 26 | void setLocation( double latitude, double longitude ); 27 | 28 | static constexpr const char *LATITUDE_SIGNAL_NAME = "latitudeSignalName"; 29 | static constexpr const char *LONGITUDE_SIGNAL_NAME = "longitudeSignalName"; 30 | 31 | private: 32 | static bool validLatitude( double latitude ); 33 | static bool validLongitude( double longitude ); 34 | 35 | std::shared_ptr mNamedSignalDataSource; 36 | std::string mLatitudeSignalName; 37 | std::string mLongitudeSignalName; 38 | }; 39 | 40 | } // namespace IoTFleetWise 41 | } // namespace Aws 42 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/ILogger.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/LogLevel.h" 7 | #include 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace IoTFleetWise 14 | { 15 | 16 | class ILogger 17 | { 18 | public: 19 | virtual ~ILogger() = default; 20 | 21 | /** 22 | * @brief Logs a log message in different way depending on the implementation class 23 | * 24 | * @param level log level 25 | * @param filename calling file 26 | * @param lineNumber line number 27 | * @param function calling function 28 | * @param logEntry actual message 29 | */ 30 | virtual void logMessage( LogLevel level, 31 | const std::string &filename, 32 | const uint32_t lineNumber, 33 | const std::string &function, 34 | const std::string &logEntry ) = 0; 35 | 36 | /** 37 | * @brief Try to flush any log that has been buffered 38 | */ 39 | virtual void flush() = 0; 40 | 41 | /** 42 | * @brief converts the Log Level enum to a human readable string 43 | * @param level the log level enum to convert 44 | * @return empty string if unrecognized LogLevel 45 | * */ 46 | static const std::string &levelToString( LogLevel level ); 47 | }; 48 | /** 49 | * @brief That the single instance of ILogger that should be used for forwarding Logs besides ConsoleLogger 50 | * 51 | * Can be called safe from any thread 52 | * 53 | * @param logForwarder the instance that should be receive Logs 54 | */ 55 | extern void setLogForwarding( ILogger *logForwarder ); 56 | 57 | } // namespace IoTFleetWise 58 | } // namespace Aws 59 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/IoTFleetWiseVersion.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | #pragma once 4 | 5 | extern const char FWE_VERSION_GIT_COMMIT_SHA[]; 6 | extern const char FWE_VERSION_GIT_TAG[]; 7 | extern const char FWE_VERSION_BUILD_TIME[]; 8 | extern const char FWE_VERSION_PROJECT_VERSION[]; 9 | 10 | extern const char FWE_VERSION_PROJECT_VERSION_MAJOR[]; 11 | extern const char FWE_VERSION_PROJECT_VERSION_MINOR[]; 12 | extern const char FWE_VERSION_PROJECT_VERSION_PATCH[]; 13 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/LogLevel.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | #pragma once 4 | 5 | #include 6 | namespace Aws 7 | { 8 | namespace IoTFleetWise 9 | { 10 | 11 | /** 12 | * @brief Log levels. 13 | */ 14 | enum class LogLevel 15 | { 16 | Trace, 17 | Info, 18 | Warning, 19 | Error, 20 | Off 21 | }; 22 | 23 | inline bool 24 | stringToLogLevel( const std::string level, LogLevel &outLogLevel ) 25 | { 26 | if ( level == "Info" ) 27 | { 28 | outLogLevel = LogLevel::Info; 29 | } 30 | else if ( level == "Error" ) 31 | { 32 | outLogLevel = LogLevel::Error; 33 | } 34 | else if ( level == "Warning" ) 35 | { 36 | outLogLevel = LogLevel::Warning; 37 | } 38 | else if ( level == "Trace" ) 39 | { 40 | outLogLevel = LogLevel::Trace; 41 | } 42 | else if ( level == "Off" ) 43 | { 44 | outLogLevel = LogLevel::Off; 45 | } 46 | else 47 | { 48 | return false; 49 | } 50 | return true; 51 | } 52 | 53 | extern LogLevel gSystemWideLogLevel; // NOLINT Global log level 54 | 55 | } // namespace IoTFleetWise 56 | } // namespace Aws 57 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/SchemaListener.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/SignalTypes.h" 7 | #include 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace IoTFleetWise 14 | { 15 | 16 | /** 17 | * @brief Class to allow for CollectionSchemeManager to trigger callbacks on the Schema Class 18 | */ 19 | class SchemaListener 20 | { 21 | public: 22 | virtual ~SchemaListener() = default; 23 | 24 | using OnCheckinSentCallback = std::function; 25 | 26 | /** 27 | * @brief Callback implementation for receiving sendCheckin requests from CollectionScheme Management 28 | * 29 | * @param documentARNs A list containing loaded collectionScheme ID's in the form of ARNs (both active and inactive) 30 | * and the loaded Decoder Manifest ID in the form of ARN if one is present. Documents do not need to be in any 31 | * order. 32 | * @param callback callback that will be called when the operation completes (successfully or not). 33 | * IMPORTANT: The callback can be called by the same thread before sendBuffer even returns 34 | * or a separate thread, depending on whether the results are known synchronously or asynchronously. 35 | */ 36 | virtual void sendCheckin( const std::vector &documentARNs, OnCheckinSentCallback callback ) = 0; 37 | }; 38 | 39 | } // namespace IoTFleetWise 40 | } // namespace Aws 41 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/StreambufBuilder.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace IoTFleetWise 12 | { 13 | 14 | /** 15 | * @brief A wrapper for deferring the creation of a streambuf until the moment it is really needed 16 | **/ 17 | class StreambufBuilder 18 | { 19 | public: 20 | virtual ~StreambufBuilder() = default; 21 | 22 | virtual std::unique_ptr build() = 0; 23 | }; 24 | 25 | } // namespace IoTFleetWise 26 | } // namespace Aws 27 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/TimeTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace Aws 9 | { 10 | namespace IoTFleetWise 11 | { 12 | 13 | using Timestamp = std::uint64_t; 14 | 15 | /** 16 | * @brief Represents a time point based on different clocks 17 | * 18 | * A particular use case for this is when passing down the current time as a parameter. 19 | * Depending on the situation either system time or a monotonic time should be used, so 20 | * it is preferable to pass this struct and let the implementation decide which one is 21 | * needed. 22 | */ 23 | struct TimePoint 24 | { 25 | Timestamp systemTimeMs; 26 | Timestamp monotonicTimeMs; 27 | }; 28 | 29 | } // namespace IoTFleetWise 30 | } // namespace Aws 31 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/VehicleDataSourceTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace Aws 9 | { 10 | namespace IoTFleetWise 11 | { 12 | 13 | // Transport Protocol used by the Vehicle Data Source 14 | enum class VehicleDataSourceProtocol 15 | { 16 | INVALID_PROTOCOL, 17 | OBD, 18 | RAW_SOCKET, 19 | CUSTOM_DECODING, 20 | #ifdef FWE_FEATURE_VISION_SYSTEM_DATA 21 | COMPLEX_DATA 22 | #endif 23 | // Add any new protocols to the list of supported protocols below 24 | }; 25 | 26 | constexpr std::array SUPPORTED_NETWORK_PROTOCOL = { 27 | { VehicleDataSourceProtocol::RAW_SOCKET, 28 | VehicleDataSourceProtocol::OBD, 29 | VehicleDataSourceProtocol::CUSTOM_DECODING, 30 | #ifdef FWE_FEATURE_VISION_SYSTEM_DATA 31 | VehicleDataSourceProtocol::COMPLEX_DATA 32 | #endif 33 | } }; 34 | 35 | } // namespace IoTFleetWise 36 | } // namespace Aws 37 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/snf/DataSenderProtoReader.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/CANInterfaceIDTranslator.h" 7 | #include "aws/iotfleetwise/CollectionInspectionAPITypes.h" 8 | #include "vehicle_data.pb.h" 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace IoTFleetWise 14 | { 15 | 16 | class DataSenderProtoReader 17 | { 18 | public: 19 | DataSenderProtoReader( CANInterfaceIDTranslator &canIDTranslator ); 20 | ~DataSenderProtoReader(); 21 | 22 | DataSenderProtoReader( const DataSenderProtoReader & ) = delete; 23 | DataSenderProtoReader &operator=( const DataSenderProtoReader & ) = delete; 24 | DataSenderProtoReader( DataSenderProtoReader && ) = delete; 25 | DataSenderProtoReader &operator=( DataSenderProtoReader && ) = delete; 26 | 27 | bool setupVehicleData( const std::string &data ); 28 | bool deserializeVehicleData( TriggeredCollectionSchemeData &out ); 29 | 30 | private: 31 | Schemas::VehicleDataMsg::VehicleData mVehicleData{}; 32 | CANInterfaceIDTranslator mIDTranslator; 33 | }; 34 | 35 | } // namespace IoTFleetWise 36 | } // namespace Aws 37 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/snf/RateLimiter.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/Clock.h" 7 | #include "aws/iotfleetwise/ClockHandler.h" 8 | #include "aws/iotfleetwise/TimeTypes.h" 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace IoTFleetWise 15 | { 16 | 17 | static constexpr std::uint32_t DEFAULT_MAX_TOKENS = 100; 18 | static constexpr std::uint32_t DEFAULT_TOKEN_REFILLS_PER_SECOND = DEFAULT_MAX_TOKENS; 19 | 20 | class RateLimiter 21 | { 22 | public: 23 | RateLimiter(); 24 | RateLimiter( uint32_t maxTokens, uint32_t tokenRefillsPerSecond ); 25 | bool consumeToken(); 26 | 27 | private: 28 | void refillTokens(); 29 | 30 | std::shared_ptr mClock = ClockHandler::getClock(); 31 | 32 | uint32_t mMaxTokens; 33 | uint32_t mTokenRefillsPerSecond; 34 | uint32_t mCurrentTokens; 35 | Timestamp mLastRefillTime; 36 | }; 37 | } // namespace IoTFleetWise 38 | } // namespace Aws 39 | -------------------------------------------------------------------------------- /include/aws/iotfleetwise/snf/StoreLogger.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace IoTFleetWise 12 | { 13 | namespace Store 14 | { 15 | class Logger : public aws::store::logging::Logger 16 | { 17 | public: 18 | Logger(); 19 | 20 | void log( aws::store::logging::LogLevel l, const std::string &message ) const override; 21 | }; 22 | } // namespace Store 23 | } // namespace IoTFleetWise 24 | } // namespace Aws 25 | -------------------------------------------------------------------------------- /interfaces/persistency/examples/persistencyMetadataFormat.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "files": [ 4 | { 5 | "filename": "exampleFile1.bin", 6 | "payloadSize": 10, 7 | "compressionRequired": false 8 | }, 9 | { 10 | "filename": "exampleFile2.bin", 11 | "payloadSize": 247, 12 | "compressionRequired": true 13 | }, 14 | { 15 | "type": "Telemetry", 16 | "payload": { 17 | "filename": "exampleFile3.bin", 18 | "payloadSize": 245, 19 | "compressionRequired": false 20 | } 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /interfaces/protobuf/schemas/edgeToCloud/checkin.proto: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | syntax = "proto3"; 5 | 6 | option java_package = "com.amazonaws.iot.autobahn.schemas"; 7 | package Aws.IoTFleetWise.Schemas.CheckinMsg; 8 | 9 | message Checkin { 10 | /* 11 | * List of document synchronization IDs the Edge currently has enacted including collectionSchemes (both idle and active) and 12 | * decoder manifest. 13 | */ 14 | repeated string document_sync_ids = 1; 15 | 16 | /* 17 | * Timestamp of when check in was generated in milliseconds since the Unix epoch 18 | */ 19 | uint64 timestamp_ms_epoch = 2; 20 | } 21 | -------------------------------------------------------------------------------- /interfaces/protobuf/schemas/edgeToCloud/command_response.proto: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | syntax = "proto3"; 5 | 6 | option java_package = "com.amazonaws.iot.autobahn.schemas"; 7 | package Aws.IoTFleetWise.Schemas.Commands; 8 | 9 | message CommandResponse { 10 | 11 | Status status = 1; 12 | 13 | /** 14 | * CommandId is the identifier passed in the command request and passed back here in the command 15 | * response in order to uniquely identify each command run. 16 | */ 17 | string command_id = 2; 18 | 19 | /** 20 | * Integer reason code. The 32-bit range is allocated as follows: 21 | * 22 | * 0x00000000 : Unspecified reason 23 | * 0x00000001 - 0x0000FFFF : AWS IoT FleetWise reason codes 24 | * 0x00010000 - 0x0001FFFF : OEM reason codes 25 | * 0x00020000 - 0xFFFFFFFF : Reserved 26 | */ 27 | uint32 reason_code = 3; 28 | 29 | /** 30 | * String reason description 31 | */ 32 | string reason_description = 4; 33 | } 34 | 35 | enum Status { 36 | COMMAND_STATUS_UNSPECIFIED = 0; 37 | COMMAND_STATUS_SUCCEEDED = 1; 38 | COMMAND_STATUS_EXECUTION_TIMEOUT = 2; 39 | COMMAND_STATUS_EXECUTION_FAILED = 4; 40 | COMMAND_STATUS_IN_PROGRESS = 10; 41 | } 42 | -------------------------------------------------------------------------------- /package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | iotfleetwise 5 | 1.0.3 6 | Contact us on GitHub: https://github.com/aws/aws-iot-fleetwise-edge 7 | Reference Implementation for AWS IoT FleetWise 8 | Apache License 2.0 9 | ament_cmake 10 | ament_lint_auto 11 | ament_lint_common 12 | 13 | ament_cmake 14 | 15 | 16 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.isort] 2 | profile = "black" 3 | line_length = 100 4 | 5 | [tool.black] 6 | line_length = 100 7 | 8 | [tool.md_dead_link_check] 9 | check_web_links = false 10 | -------------------------------------------------------------------------------- /src/AwsSDKMemoryManager.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "aws/iotfleetwise/AwsSDKMemoryManager.h" 5 | #include "aws/iotfleetwise/TraceModule.h" 6 | #include 7 | 8 | namespace Aws 9 | { 10 | namespace IoTFleetWise 11 | { 12 | 13 | AwsSDKMemoryManager & 14 | AwsSDKMemoryManager::getInstance() 15 | { 16 | static AwsSDKMemoryManager instance; 17 | return instance; 18 | } 19 | 20 | std::size_t 21 | AwsSDKMemoryManager::getLimit() 22 | { 23 | std::lock_guard lock( mMutex ); 24 | return mMaximumAwsSDKMemorySize; 25 | } 26 | 27 | bool 28 | AwsSDKMemoryManager::setLimit( size_t size ) 29 | { 30 | std::lock_guard lock( mMutex ); 31 | if ( size == 0U ) 32 | { 33 | return false; 34 | } 35 | mMaximumAwsSDKMemorySize = size; 36 | return true; 37 | } 38 | 39 | bool 40 | AwsSDKMemoryManager::reserveMemory( std::size_t bytes ) 41 | { 42 | std::lock_guard lock( mMutex ); 43 | if ( ( mMemoryUsedAndReserved + bytes ) > mMaximumAwsSDKMemorySize ) 44 | { 45 | return false; 46 | } 47 | mMemoryUsedAndReserved += bytes; 48 | TraceModule::get().setVariable( TraceVariable::MQTT_HEAP_USAGE, mMemoryUsedAndReserved ); 49 | return true; 50 | } 51 | 52 | std::size_t 53 | AwsSDKMemoryManager::releaseReservedMemory( std::size_t bytes ) 54 | { 55 | std::lock_guard lock( mMutex ); 56 | mMemoryUsedAndReserved -= bytes; 57 | TraceModule::get().setVariable( TraceVariable::MQTT_HEAP_USAGE, mMemoryUsedAndReserved ); 58 | return mMemoryUsedAndReserved; 59 | } 60 | 61 | } // namespace IoTFleetWise 62 | } // namespace Aws 63 | -------------------------------------------------------------------------------- /src/IoTFleetWiseVersion.cpp.in: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | // coverity[autosar_cpp14_a16_2_2_violation] False positive - header is required to declare constants below 5 | #include "aws/iotfleetwise/IoTFleetWiseVersion.h" 6 | 7 | // This file will be filled by CMAKE configure_file with the right values and placed in the build folder 8 | const char FWE_VERSION_GIT_COMMIT_SHA[] = "@FWE_VERSION_GIT_SHA@"; 9 | const char FWE_VERSION_GIT_TAG[] = "@FWE_VERSION_GIT_TAG@"; 10 | const char FWE_VERSION_BUILD_TIME[] = "@FWE_VERSION_CURRENT_TIME@"; 11 | const char FWE_VERSION_PROJECT_VERSION[] = "@PROJECT_VERSION@"; 12 | 13 | const char FWE_VERSION_PROJECT_VERSION_MAJOR[] = "@PROJECT_VERSION_MAJOR@"; 14 | const char FWE_VERSION_PROJECT_VERSION_MINOR[] = "@PROJECT_VERSION_MINOR@"; 15 | const char FWE_VERSION_PROJECT_VERSION_PATCH[] = "@PROJECT_VERSION_PATCH@"; 16 | -------------------------------------------------------------------------------- /src/LastKnownStateSchema.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "aws/iotfleetwise/LastKnownStateSchema.h" 5 | #include "aws/iotfleetwise/LoggingModule.h" 6 | #include "aws/iotfleetwise/TraceModule.h" 7 | 8 | namespace Aws 9 | { 10 | namespace IoTFleetWise 11 | { 12 | 13 | LastKnownStateSchema::LastKnownStateSchema( IReceiver &receiverLastKnownState ) 14 | { 15 | receiverLastKnownState.subscribeToDataReceived( [this]( const ReceivedConnectivityMessage &receivedMessage ) { 16 | onLastKnownStateReceived( receivedMessage ); 17 | } ); 18 | } 19 | 20 | void 21 | LastKnownStateSchema::onLastKnownStateReceived( const ReceivedConnectivityMessage &receivedMessage ) 22 | { 23 | auto lastKnownStateIngestion = std::make_shared(); 24 | 25 | if ( !lastKnownStateIngestion->copyData( receivedMessage.buf, receivedMessage.size ) ) 26 | { 27 | FWE_LOG_ERROR( "LastKnownState copyData from IoT core failed" ); 28 | return; 29 | } 30 | 31 | mLastKnownStateListeners.notify( lastKnownStateIngestion ); 32 | FWE_LOG_TRACE( "Received state templates" ); 33 | TraceModule::get().incrementVariable( TraceVariable::STATE_TEMPLATES_RECEIVED ); 34 | } 35 | 36 | } // namespace IoTFleetWise 37 | } // namespace Aws 38 | -------------------------------------------------------------------------------- /src/snf/RateLimiter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "aws/iotfleetwise/snf/RateLimiter.h" 5 | #include "aws/iotfleetwise/Clock.h" 6 | 7 | namespace Aws 8 | { 9 | namespace IoTFleetWise 10 | { 11 | 12 | RateLimiter::RateLimiter() 13 | : mMaxTokens( DEFAULT_MAX_TOKENS ) 14 | , mTokenRefillsPerSecond( DEFAULT_TOKEN_REFILLS_PER_SECOND ) 15 | , mCurrentTokens( DEFAULT_MAX_TOKENS ) 16 | , mLastRefillTime( mClock->timeSinceEpoch().monotonicTimeMs ) 17 | { 18 | } 19 | 20 | RateLimiter::RateLimiter( uint32_t maxTokens, uint32_t tokenRefillsPerSecond ) 21 | : mMaxTokens( maxTokens ) 22 | , mTokenRefillsPerSecond( tokenRefillsPerSecond ) 23 | , mCurrentTokens( maxTokens ) 24 | , mLastRefillTime( mClock->timeSinceEpoch().monotonicTimeMs ) 25 | { 26 | } 27 | 28 | bool 29 | RateLimiter::consumeToken() 30 | { 31 | refillTokens(); 32 | if ( mCurrentTokens > 0 ) 33 | { 34 | --mCurrentTokens; 35 | return true; 36 | } 37 | return false; 38 | } 39 | 40 | void 41 | RateLimiter::refillTokens() 42 | { 43 | auto currTime = mClock->timeSinceEpoch().monotonicTimeMs; 44 | auto secondsElapsed = ( currTime - mLastRefillTime ) / 1000; 45 | if ( secondsElapsed > 0 ) 46 | { 47 | auto newTokens = secondsElapsed * mTokenRefillsPerSecond; 48 | mCurrentTokens = newTokens >= mMaxTokens ? mMaxTokens : static_cast( newTokens ); 49 | mLastRefillTime = currTime; 50 | } 51 | } 52 | 53 | } // namespace IoTFleetWise 54 | } // namespace Aws 55 | -------------------------------------------------------------------------------- /test/system/.gitignore: -------------------------------------------------------------------------------- 1 | testframework/gen/ 2 | run/ 3 | -------------------------------------------------------------------------------- /test/system/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | xfail_strict = true 3 | addopts = 4 | --strict-markers 5 | -vvv 6 | -ra 7 | --color=yes 8 | --junit-xml=run/report.xml 9 | --html=run/html_report/index.html 10 | -p no:legacypath 11 | 12 | filterwarnings = 13 | error 14 | # Show logs while the test is running. See https://docs.pytest.org/en/latest/logging.html 15 | # log_cli = true 16 | # This config can't be in setup.cfg. See https://github.com/pytest-dev/pytest/issues/3062 17 | log_format = %(asctime)s.%(msecs)03d %(levelname)-8s %(threadName)-20s %(name)s:%(filename)s:%(lineno)-8d %(message)s 18 | log_date_format = %Y-%m-%d %H:%M:%S 19 | -------------------------------------------------------------------------------- /test/system/requirements.txt: -------------------------------------------------------------------------------- 1 | awsiotsdk==1.17.0 2 | boto3==1.20.34 3 | botocore==1.23.54 4 | urllib3==1.26.20 5 | protobuf==3.20.2 6 | can-isotp==1.7 7 | prompt_toolkit==3.0.21 8 | cantools==36.4.0 9 | matplotlib==3.4.3 # via cantools 10 | python-can==3.3.4 # via cantools 11 | wrapt==1.10.0 # via python-can 12 | pytest==8.3.2 13 | pytest-html==4.1.1 14 | ansi2html==1.9.2 15 | pytest-metadata==3.1.1 16 | pytest-random-order==1.1.1 17 | pytest-xdist==3.6.1 18 | python-snappy==0.6.1 19 | tenacity==8.2.3 20 | amazon.ion==0.10.0 21 | numpy==1.26.4 22 | python-dynamodb-lock==0.9.1 23 | pyparsing==2.4.6 24 | someip==0.3.0 25 | filelock==3.15.4 26 | jsonschema==4.23.0 27 | -------------------------------------------------------------------------------- /test/system/testframework/cyclonedds.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | lo 6 | 7 | configstderr 8 | 9 | 10 | auto 11 | 12 | 100 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/system/testframework/cyclonedds_hil.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | configstderr 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/system/testframework/cyclonedds_network_namespace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NETWORK_INTERFACE_ADDRESS_PLACEHOLDER 6 | true 7 | 8 | configstderr 9 | 10 | 11 | 16 | false 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/system/testframework/greengrass_nucleus_config.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | # For reference of what is available, check: 4 | # https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html 5 | # https://github.com/aws-greengrass/aws-greengrass-nucleus/blob/main/README_CONFIG_SCHEMA.md 6 | system: 7 | rootpath: "ROOT_PATH_PLACEHOLDER" 8 | certificateFilePath: "CERTIFICATE_FILENAME_PLACEHOLDER" 9 | privateKeyPath: "PRIVATE_KEY_FILENAME_PLACEHOLDER" 10 | rootCaPath: "ROOT_CA_FILENAME_PLACEHOLDER" 11 | thingName: "THING_NAME_PLACEHOLDER" 12 | ipcSocketPath: "IPC_SOCKET_PATH_PLACEHOLDER" 13 | services: 14 | aws.greengrass.Nucleus: 15 | version: "2.14.2" 16 | configuration: 17 | awsRegion: "AWS_REGION_PLACEHOLDER" 18 | deploymentPollingFrequencySeconds: 5 19 | iotRoleAlias: "IOT_ROLE_ALIAS_PLACEHOLDER" 20 | iotDataEndpoint: "IOT_DATA_ENDPOINT_PLACEHOLDER" 21 | iotCredEndpoint: "IOT_CRED_ENDPOINT_PLACEHOLDER" 22 | logging: 23 | level: DEBUG 24 | fileSizeKB: 10240 25 | totalLogsSizeKB: 102400 26 | format: TEXT 27 | outputDirectory: "LOG_DIR_PLACEHOLDER" 28 | outputType: FILE 29 | mqtt: 30 | keepAliveTimeoutMs: "KEEP_ALIVE_TIMEOUT_MS_PLACEHOLDER" 31 | pingTimeoutMs: "PING_TIMEOUT_MS_PLACEHOLDER" 32 | sessionExpirySeconds: "SESSION_EXPIRY_SECONDS_PLACEHOLDER" 33 | -------------------------------------------------------------------------------- /test/system/testframework/ros2-config-data-engine-e2e-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "messages": [ 3 | { 4 | "fullyQualifiedName": "Vehicle.DifferentTypesTestTopic", 5 | "interfaceId": "3", 6 | "topic": "DifferentTypesTestTopic", 7 | "type": "ros2_custom_messages/msg/DifferentTypesTest" 8 | }, 9 | { 10 | "fullyQualifiedName": "Vehicle.CompressedImageTopic1", 11 | "interfaceId": "3", 12 | "topic": "CompressedImageTopic1", 13 | "type": "sensor_msgs/msg/CompressedImage" 14 | }, 15 | { 16 | "fullyQualifiedName": "Vehicle.CompressedImageTopic2", 17 | "interfaceId": "3", 18 | "topic": "CompressedImageTopic2", 19 | "type": "sensor_msgs/msg/CompressedImage" 20 | }, 21 | { 22 | "fullyQualifiedName": "Vehicle.ImageTopic1", 23 | "interfaceId": "3", 24 | "topic": "ImageTopic1", 25 | "type": "sensor_msgs/msg/Image" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /test/system/testframework/ros2-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "messages": [ 3 | { 4 | "fullyQualifiedName": "ImageTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 5 | "interfaceId": "10", 6 | "topic": "ImageTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 7 | "type": "sensor_msgs/msg/Image" 8 | }, 9 | { 10 | "fullyQualifiedName": "PointFieldTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 11 | "interfaceId": "10", 12 | "topic": "PointFieldTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 13 | "type": "sensor_msgs/msg/PointField" 14 | }, 15 | { 16 | "fullyQualifiedName": "DifferentTypesTestTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 17 | "interfaceId": "10", 18 | "topic": "DifferentTypesTestTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 19 | "type": "ros2_custom_messages/msg/DifferentTypesTest" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /test/system/testframework/ros2_custom_messages/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | cmake_minimum_required(VERSION 3.8) 5 | project(ros2_custom_messages) 6 | 7 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 8 | add_compile_options(-Wall -Wextra -Wpedantic) 9 | endif() 10 | 11 | # find dependencies 12 | find_package(ament_cmake REQUIRED) 13 | find_package(rosidl_default_generators REQUIRED) 14 | 15 | set(msg_files 16 | "msg/DifferentTypesTest.msg" 17 | "msg/NestedTestMessage.msg" 18 | "msg/Nested2TestMessage.msg" 19 | ) 20 | 21 | rosidl_generate_interfaces(${PROJECT_NAME} 22 | ${msg_files} 23 | ) 24 | 25 | ament_export_dependencies(rosidl_default_runtime) 26 | 27 | ament_package() 28 | -------------------------------------------------------------------------------- /test/system/testframework/ros2_custom_messages/msg/Nested2TestMessage.msg: -------------------------------------------------------------------------------- 1 | uint8 nested_value_uint8 2 | -------------------------------------------------------------------------------- /test/system/testframework/ros2_custom_messages/msg/NestedTestMessage.msg: -------------------------------------------------------------------------------- 1 | bool nested_value_bool 2 | Nested2TestMessage nested_message_2 3 | -------------------------------------------------------------------------------- /test/system/testframework/ros2_custom_messages/msg/PumpUpMessageMain.msg: -------------------------------------------------------------------------------- 1 | PumpUpMessageNested1[] very_long_name_to_get_the_very_verbose_json_pumped_up_to_more_than_factor_hundred_of_original_cdr 2 | -------------------------------------------------------------------------------- /test/system/testframework/ros2_custom_messages/msg/PumpUpMessageNested1.msg: -------------------------------------------------------------------------------- 1 | PumpUpMessageNested2 very_long_name_to_get_the_very_verbose_json_pumped_up_to_more_than_factor_hundred_of_original_cdr_nested1 2 | -------------------------------------------------------------------------------- /test/system/testframework/ros2_custom_messages/msg/PumpUpMessageNested2.msg: -------------------------------------------------------------------------------- 1 | PumpUpMessageNestedEnd very_long_name_to_get_the_very_verbose_json_pumped_up_to_more_than_factor_hundred_of_original_cdr_nested2 2 | -------------------------------------------------------------------------------- /test/system/testframework/ros2_custom_messages/msg/PumpUpMessageNestedEnd.msg: -------------------------------------------------------------------------------- 1 | bool very_long_name_to_get_the_very_verbose_json_pumped_up_to_more_than_factor_hundred_of_original_cdr_end 2 | -------------------------------------------------------------------------------- /test/system/testframework/ros2_custom_messages/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ros2_custom_messages 5 | 0.0.1 6 | Custom Message Types to test implementation 7 | Contact us on GitHub: https://github.com/aws/aws-iot-fleetwise-edge 8 | Apache License 2.0 9 | 10 | ament_cmake 11 | 12 | ament_lint_auto 13 | ament_lint_common 14 | 15 | rosidl_default_generators 16 | rosidl_default_runtime 17 | rosidl_interface_packages 18 | 19 | 20 | ament_cmake 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/system/testframework/ros_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "topics": [ 3 | { 4 | "name": "ImageTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 5 | "module": "sensor_msgs.msg", 6 | "type": "Image", 7 | "period_sec": 1 8 | }, 9 | { 10 | "name": "PointFieldTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 11 | "module": "sensor_msgs.msg", 12 | "type": "PointField", 13 | "period_sec": 1 14 | }, 15 | { 16 | "name": "DifferentTypesTestTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 17 | "module": "ros2_custom_messages.msg", 18 | "type": "DifferentTypesTest", 19 | "period_sec": 1 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /test/system/testframework/ros_config_high_load.json: -------------------------------------------------------------------------------- 1 | { 2 | "topics": [ 3 | { 4 | "name": "ImageTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 5 | "module": "sensor_msgs.msg", 6 | "type": "Image", 7 | "period_sec": 0.01 8 | }, 9 | { 10 | "name": "PointFieldTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 11 | "module": "sensor_msgs.msg", 12 | "type": "PointField", 13 | "period_sec": 0.01 14 | }, 15 | { 16 | "name": "DifferentTypesTestTopicROS2_TOPIC_NUMBER_PLACEHOLDER", 17 | "module": "ros2_custom_messages.msg", 18 | "type": "DifferentTypesTest", 19 | "period_sec": 0.01 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /test/system/testframework/someip_routing_manager.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | if __name__ == "__main__": 5 | import signal 6 | import sys 7 | import time 8 | 9 | from someipigen import SignalManager 10 | 11 | signal.signal(signal.SIGTERM, signal.getsignal(signal.SIGINT)) 12 | 13 | sys.stdout.write("Starting SignalManager\n") 14 | sys.stdout.flush() 15 | someip_routing_manager = SignalManager() 16 | someip_routing_manager.start("local", "RoutingManager", "someipigen") 17 | 18 | try: 19 | while True: 20 | time.sleep(1) 21 | except KeyboardInterrupt: 22 | sys.stdout.write("Stopping SignalManager\n") 23 | sys.stdout.flush() 24 | someip_routing_manager.stop() 25 | -------------------------------------------------------------------------------- /test/unit/ClockHandlerBenchmarkTest.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "aws/iotfleetwise/Clock.h" 5 | #include "aws/iotfleetwise/ClockHandler.h" 6 | #include 7 | #include 8 | 9 | static void 10 | BM_timestampToString( benchmark::State &state ) 11 | { 12 | auto clock = Aws::IoTFleetWise::ClockHandler::getClock(); 13 | for ( auto _ : state ) 14 | { 15 | clock->currentTimeToIsoString(); 16 | } 17 | } 18 | BENCHMARK( BM_timestampToString ); 19 | 20 | static void 21 | BM_systemTimeSinceEpochMs( benchmark::State &state ) 22 | { 23 | auto clock = Aws::IoTFleetWise::ClockHandler::getClock(); 24 | for ( auto _ : state ) 25 | clock->systemTimeSinceEpochMs(); 26 | } 27 | BENCHMARK( BM_systemTimeSinceEpochMs ); 28 | 29 | BENCHMARK_MAIN(); 30 | -------------------------------------------------------------------------------- /test/unit/ClockHandlerTest.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "aws/iotfleetwise/ClockHandler.h" 5 | #include "aws/iotfleetwise/Clock.h" 6 | #include 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace IoTFleetWise 12 | { 13 | 14 | TEST( ClockHandlerTest, systemTimeSinceEpochMs ) 15 | { 16 | auto clock = ClockHandler::getClock(); 17 | ASSERT_NE( clock.get(), nullptr ); 18 | ASSERT_GT( clock->systemTimeSinceEpochMs(), 0ull ); 19 | } 20 | 21 | } // namespace IoTFleetWise 22 | } // namespace Aws 23 | -------------------------------------------------------------------------------- /test/unit/LoggingModuleTest.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | #include "aws/iotfleetwise/LoggingModule.h" 6 | #include "aws/iotfleetwise/ConsoleLogger.h" 7 | #include 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace IoTFleetWise 13 | { 14 | 15 | TEST( LoggingModuleTest, GetErrnoString ) 16 | { 17 | // Try to open a non existing file 18 | FILE *fp = fopen( "/tmp/fwe_strerror_test/2f1d6e5e5ab1", "rb" ); 19 | (void)fp; 20 | ASSERT_NE( getErrnoString(), "" ); 21 | } 22 | 23 | TEST( LoggingModuleTest, stringToLogColorOption ) 24 | { 25 | LogColorOption outLogColorOption; 26 | EXPECT_TRUE( stringToLogColorOption( "Auto", outLogColorOption ) ); 27 | EXPECT_EQ( outLogColorOption, LogColorOption::Auto ); 28 | EXPECT_TRUE( stringToLogColorOption( "Yes", outLogColorOption ) ); 29 | EXPECT_EQ( outLogColorOption, LogColorOption::Yes ); 30 | EXPECT_TRUE( stringToLogColorOption( "No", outLogColorOption ) ); 31 | EXPECT_EQ( outLogColorOption, LogColorOption::No ); 32 | EXPECT_FALSE( stringToLogColorOption( "Invalid", outLogColorOption ) ); 33 | } 34 | 35 | } // namespace IoTFleetWise 36 | } // namespace Aws 37 | -------------------------------------------------------------------------------- /test/unit/MemoryUsageInfoTest.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | #include "aws/iotfleetwise/MemoryUsageInfo.h" 6 | 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace IoTFleetWise 12 | { 13 | 14 | TEST( MemoryUsageInfoTest, testMemoryUsageInfo ) 15 | { 16 | MemoryUsageInfo usage; 17 | 18 | ASSERT_TRUE( usage.reportMemoryUsageInfo() ); 19 | ASSERT_GE( usage.getMaxResidentMemorySize(), 0 ); 20 | ASSERT_GE( usage.getResidentMemorySize(), 0 ); 21 | ASSERT_GE( usage.getVirtualMemorySize(), 0 ); 22 | } 23 | 24 | } // namespace IoTFleetWise 25 | } // namespace Aws 26 | -------------------------------------------------------------------------------- /test/unit/ThreadTest.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "aws/iotfleetwise/Thread.h" 5 | #include 6 | #include 7 | #include 8 | 9 | namespace Aws 10 | { 11 | namespace IoTFleetWise 12 | { 13 | 14 | void 15 | workerFunction() 16 | { 17 | std::cout << "Hello from IoTFleetWise"; 18 | usleep( 500000 ); 19 | } 20 | 21 | TEST( ThreadTest, ThreadCPUUsageInfo ) 22 | { 23 | Thread thread; 24 | ASSERT_TRUE( !thread.isValid() ); 25 | ASSERT_TRUE( thread.create( workerFunction ) ); 26 | ASSERT_TRUE( thread.isActive() ); 27 | ASSERT_TRUE( thread.isValid() ); 28 | thread.release(); 29 | ASSERT_TRUE( !thread.isValid() ); 30 | ASSERT_TRUE( !thread.isActive() ); 31 | } 32 | 33 | } // namespace IoTFleetWise 34 | } // namespace Aws 35 | -------------------------------------------------------------------------------- /test/unit/TimerTest.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "aws/iotfleetwise/Timer.h" 5 | #include 6 | 7 | namespace Aws 8 | { 9 | namespace IoTFleetWise 10 | { 11 | 12 | TEST( TimerTest, timerState ) 13 | { 14 | Timer timer; 15 | ASSERT_TRUE( timer.isTimerRunning() ); 16 | timer.pause(); 17 | ASSERT_FALSE( timer.isTimerRunning() ); 18 | timer.resume(); 19 | ASSERT_TRUE( timer.isTimerRunning() ); 20 | timer.reset(); 21 | ASSERT_TRUE( timer.isTimerRunning() ); 22 | } 23 | 24 | TEST( TimerTest, timerTickCount ) 25 | { 26 | Timer timer; 27 | ASSERT_TRUE( timer.isTimerRunning() ); 28 | ASSERT_GE( timer.getElapsedMs().count(), 0LU ); 29 | ASSERT_GE( timer.getElapsedSeconds(), 0 ); 30 | } 31 | 32 | } // namespace IoTFleetWise 33 | } // namespace Aws 34 | -------------------------------------------------------------------------------- /test/unit/support/CommandDispatcherMock.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/ICommandDispatcher.h" 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace IoTFleetWise 16 | { 17 | namespace Testing 18 | { 19 | 20 | class CommandDispatcherMock : public ICommandDispatcher 21 | { 22 | public: 23 | CommandDispatcherMock() 24 | : ICommandDispatcher() 25 | { 26 | } 27 | 28 | MOCK_METHOD( bool, init, () ); 29 | MOCK_METHOD( void, 30 | setActuatorValue, 31 | ( const std::string &actuatorName, 32 | const SignalValueWrapper &signalValue, 33 | const CommandID &commandId, 34 | Timestamp issuedTimestampMs, 35 | Timestamp executionTimeoutMs, 36 | NotifyCommandStatusCallback notifyStatusCallback ) ); 37 | MOCK_METHOD( std::vector, getActuatorNames, () ); 38 | }; 39 | 40 | } // namespace Testing 41 | } // namespace IoTFleetWise 42 | } // namespace Aws 43 | -------------------------------------------------------------------------------- /test/unit/support/CommonAPIProxyMock.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #if !defined( COMMONAPI_INTERNAL_COMPILATION ) 8 | #define COMMONAPI_INTERNAL_COMPILATION 9 | #define HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE 10 | #endif 11 | #include 12 | #ifdef HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE 13 | #undef COMMONAPI_INTERNAL_COMPILATION 14 | #undef HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE 15 | #endif 16 | #include 17 | 18 | class CommonAPIProxyMock : public CommonAPI::Proxy 19 | { 20 | public: 21 | MOCK_METHOD( const CommonAPI::Address &, getAddress, (), ( const ) ); 22 | MOCK_METHOD( std::future, getCompletionFuture, () ); 23 | MOCK_METHOD( bool, isAvailable, (), ( const ) ); 24 | MOCK_METHOD( bool, isAvailableBlocking, (), ( const ) ); 25 | MOCK_METHOD( CommonAPI::ProxyStatusEvent &, getProxyStatusEvent, () ); 26 | MOCK_METHOD( CommonAPI::InterfaceVersionAttribute &, getInterfaceVersionAttribute, () ); 27 | }; 28 | -------------------------------------------------------------------------------- /test/unit/support/ConnectivityModuleMock.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/IConnectivityModule.h" 7 | #include 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace IoTFleetWise 13 | { 14 | namespace Testing 15 | { 16 | 17 | class ConnectivityModuleMock : public IConnectivityModule 18 | { 19 | public: 20 | MOCK_METHOD( bool, isAlive, (), ( const, override ) ); 21 | 22 | std::shared_ptr 23 | createSender() override 24 | { 25 | return mockedCreateSender(); 26 | }; 27 | 28 | MOCK_METHOD( std::shared_ptr, mockedCreateSender, () ); 29 | 30 | std::shared_ptr 31 | createReceiver( const std::string &topicName ) override 32 | { 33 | return mockedCreateReceiver( topicName ); 34 | }; 35 | 36 | MOCK_METHOD( std::shared_ptr, mockedCreateReceiver, ( const std::string &topicName ) ); 37 | 38 | MOCK_METHOD( bool, disconnect, (), ( override ) ); 39 | 40 | MOCK_METHOD( bool, connect, (), ( override ) ); 41 | 42 | MOCK_METHOD( void, subscribeToConnectionEstablished, ( OnConnectionEstablishedCallback callback ), ( override ) ); 43 | }; 44 | 45 | } // namespace Testing 46 | } // namespace IoTFleetWise 47 | } // namespace Aws 48 | -------------------------------------------------------------------------------- /test/unit/support/DataSenderIonWriterMock.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/CollectionInspectionAPITypes.h" 7 | #include "aws/iotfleetwise/DataSenderIonWriter.h" 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace IoTFleetWise 15 | { 16 | namespace Testing 17 | { 18 | 19 | class DataSenderIonWriterMock : public DataSenderIonWriter 20 | { 21 | public: 22 | DataSenderIonWriterMock() 23 | : DataSenderIonWriter( nullptr, "" ){}; 24 | 25 | // Record the calls so that we can wait for asynchronous calls to happen. 26 | std::vector mSignals; 27 | 28 | MOCK_METHOD( void, 29 | setupVehicleData, 30 | ( const TriggeredVisionSystemData &mTriggeredVisionSystemData ), 31 | ( override ) ); 32 | 33 | MOCK_METHOD( std::unique_ptr, getStreambufBuilder, (), ( override ) ); 34 | void 35 | append( const CollectedSignal &signal ) override 36 | { 37 | mSignals.push_back( signal ); 38 | mockedAppend( signal ); 39 | }; 40 | MOCK_METHOD( void, mockedAppend, ( const CollectedSignal &signal ) ); 41 | }; 42 | 43 | } // namespace Testing 44 | } // namespace IoTFleetWise 45 | } // namespace Aws 46 | -------------------------------------------------------------------------------- /test/unit/support/PayloadManagerMock.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/PayloadManager.h" 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Aws 13 | { 14 | namespace IoTFleetWise 15 | { 16 | namespace Testing 17 | { 18 | 19 | class PayloadManagerMock : public PayloadManager 20 | { 21 | public: 22 | PayloadManagerMock() 23 | : PayloadManager( nullptr ){}; 24 | 25 | MOCK_METHOD( bool, storeData, ( const std::uint8_t *buf, size_t size, const Json::Value &metadata ), ( override ) ); 26 | 27 | MOCK_METHOD( ErrorCode, retrievePayloadMetadata, ( Json::Value & files ), ( override ) ); 28 | 29 | MOCK_METHOD( ErrorCode, 30 | retrievePayload, 31 | ( uint8_t * buf, size_t size, const std::string &filename ), 32 | ( override ) ); 33 | }; 34 | 35 | } // namespace Testing 36 | } // namespace IoTFleetWise 37 | } // namespace Aws 38 | -------------------------------------------------------------------------------- /test/unit/support/S3SenderMock.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/S3Sender.h" 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace IoTFleetWise 16 | { 17 | namespace Testing 18 | { 19 | 20 | class S3SenderMock : public S3Sender 21 | { 22 | public: 23 | S3SenderMock() 24 | : S3Sender( 25 | []( Aws::Client::ClientConfiguration &, 26 | Aws::Transfer::TransferManagerConfiguration & ) -> std::shared_ptr { 27 | return nullptr; 28 | }, 29 | 0, 30 | 3000 ) 31 | { 32 | } 33 | 34 | MOCK_METHOD( void, 35 | sendStream, 36 | ( std::unique_ptr streambufBuilder, 37 | const S3UploadMetadata &uploadMetadata, 38 | const std::string &objectKey, 39 | ResultCallback resultCallback ), 40 | ( override ) ); 41 | }; 42 | 43 | } // namespace Testing 44 | } // namespace IoTFleetWise 45 | } // namespace Aws 46 | -------------------------------------------------------------------------------- /test/unit/support/StreamForwarderMock.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "StreamManagerMock.h" 7 | #include "aws/iotfleetwise/snf/StreamForwarder.h" 8 | #include 9 | #include 10 | 11 | namespace Aws 12 | { 13 | namespace IoTFleetWise 14 | { 15 | namespace Testing 16 | { 17 | 18 | class StreamForwarderMock : public Aws::IoTFleetWise::Store::StreamForwarder 19 | { 20 | public: 21 | explicit StreamForwarderMock( StreamManagerMock &streamManager, 22 | TelemetryDataSender &dataSender, 23 | RateLimiter &rateLimiter ) 24 | : StreamForwarder( streamManager, dataSender, rateLimiter ){}; 25 | 26 | MOCK_METHOD( void, registerJobCompletionCallback, ( JobCompletionCallback callback ), ( override ) ); 27 | 28 | MOCK_METHOD( void, 29 | beginForward, 30 | ( const Aws::IoTFleetWise::Store::CampaignName &campaignID, 31 | Aws::IoTFleetWise::Store::PartitionID pID, 32 | Aws::IoTFleetWise::Store::StreamForwarder::Source source ), 33 | ( override ) ); 34 | 35 | MOCK_METHOD( void, 36 | cancelForward, 37 | ( const Aws::IoTFleetWise::Store::CampaignName &campaignID, 38 | Aws::IoTFleetWise::Store::PartitionID pID, 39 | Aws::IoTFleetWise::Store::StreamForwarder::Source source ), 40 | ( override ) ); 41 | }; 42 | 43 | } // namespace Testing 44 | } // namespace IoTFleetWise 45 | } // namespace Aws 46 | -------------------------------------------------------------------------------- /test/unit/support/StreamManagerMock.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/snf/StreamManager.h" 7 | #include 8 | #include 9 | 10 | namespace Aws 11 | { 12 | namespace IoTFleetWise 13 | { 14 | namespace Testing 15 | { 16 | 17 | class StreamManagerMock : public Aws::IoTFleetWise::Store::StreamManager 18 | { 19 | public: 20 | explicit StreamManagerMock( std::unique_ptr protoWriter ) 21 | : StreamManager( "", std::move( protoWriter ), 0 ){}; 22 | 23 | MOCK_METHOD( Store::StreamManager::ReturnCode, appendToStreams, ( const TriggeredCollectionSchemeData &data ) ); 24 | 25 | MOCK_METHOD( bool, hasCampaign, ( const Aws::IoTFleetWise::Store::CampaignName &campaignName ) ); 26 | }; 27 | 28 | } // namespace Testing 29 | } // namespace IoTFleetWise 30 | } // namespace Aws 31 | -------------------------------------------------------------------------------- /test/unit/support/StringbufBuilder.h: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "aws/iotfleetwise/StreambufBuilder.h" 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Aws 14 | { 15 | namespace IoTFleetWise 16 | { 17 | namespace Testing 18 | { 19 | 20 | class StringbufBuilder : public StreambufBuilder 21 | { 22 | public: 23 | StringbufBuilder( std::string data ) 24 | : mStreambuf( std::make_unique( std::move( data ) ) ) 25 | { 26 | } 27 | 28 | StringbufBuilder( std::unique_ptr streambuf ) 29 | : mStreambuf( std::move( streambuf ) ) 30 | { 31 | } 32 | 33 | std::unique_ptr 34 | build() override 35 | { 36 | return std::move( mStreambuf ); 37 | } 38 | 39 | private: 40 | std::unique_ptr mStreambuf; 41 | }; 42 | 43 | } // namespace Testing 44 | } // namespace IoTFleetWise 45 | } // namespace Aws 46 | -------------------------------------------------------------------------------- /test/unit/support/ros2-mock-include/rcpputils/shared_library.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | namespace rcpputils 7 | { 8 | 9 | class SharedLibrary 10 | { 11 | }; 12 | 13 | } // namespace rcpputils 14 | -------------------------------------------------------------------------------- /test/unit/support/ros2-mock-include/rosidl_typesupport_introspection_cpp/field_types.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | // NOLINTNEXTLINE 9 | // only for mocking these are not the real values of the implementation 10 | namespace rosidl_typesupport_introspection_cpp 11 | { 12 | const uint8_t ROS_TYPE_FLOAT = 0; 13 | const uint8_t ROS_TYPE_DOUBLE = 1; 14 | const uint8_t ROS_TYPE_LONG_DOUBLE = 2; 15 | const uint8_t ROS_TYPE_CHAR = 3; 16 | const uint8_t ROS_TYPE_WCHAR = 4; 17 | const uint8_t ROS_TYPE_BOOLEAN = 5; 18 | const uint8_t ROS_TYPE_OCTET = 6; 19 | const uint8_t ROS_TYPE_UINT8 = 7; 20 | const uint8_t ROS_TYPE_INT8 = 8; 21 | const uint8_t ROS_TYPE_UINT16 = 9; 22 | const uint8_t ROS_TYPE_INT16 = 10; 23 | const uint8_t ROS_TYPE_UINT32 = 11; 24 | const uint8_t ROS_TYPE_INT32 = 12; 25 | const uint8_t ROS_TYPE_UINT64 = 13; 26 | const uint8_t ROS_TYPE_INT64 = 14; 27 | const uint8_t ROS_TYPE_STRING = 15; 28 | const uint8_t ROS_TYPE_WSTRING = 16; 29 | 30 | const uint8_t ROS_TYPE_MESSAGE = 17; 31 | 32 | } // namespace rosidl_typesupport_introspection_cpp 33 | -------------------------------------------------------------------------------- /test/unit/support/ros2-mock-include/rosidl_typesupport_introspection_cpp/identifier.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | // NOLINTNEXTLINE 7 | namespace rosidl_typesupport_introspection_cpp 8 | { 9 | 10 | extern const char *typesupport_identifier; 11 | 12 | } // namespace rosidl_typesupport_introspection_cpp 13 | -------------------------------------------------------------------------------- /test/unit/support/ros2-mock-include/rosidl_typesupport_introspection_cpp/message_introspection.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "rosidl_typesupport_introspection_cpp/field_types.hpp" 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | // NOLINTNEXTLINE 13 | namespace rosidl_typesupport_introspection_cpp 14 | { 15 | 16 | class MessageMembers; 17 | 18 | class MessageMember 19 | { 20 | public: 21 | MessageMember( uint8_t primitiveType ) 22 | : is_array_( false ) 23 | , array_size_( 0 ) 24 | , is_upper_bound_( false ) 25 | , type_id_( primitiveType ) 26 | , members_( nullptr ) 27 | { 28 | } 29 | MessageMember() = default; 30 | bool is_array_; 31 | size_t array_size_; 32 | bool is_upper_bound_; 33 | uint8_t type_id_; 34 | MessageMembers *members_; 35 | }; 36 | 37 | class MessageMembers 38 | { 39 | public: 40 | size_t member_count_; 41 | std::vector members_; 42 | void *data; 43 | }; 44 | 45 | } // namespace rosidl_typesupport_introspection_cpp 46 | -------------------------------------------------------------------------------- /test/unit/support/ros2-mock-include/rosidl_typesupport_introspection_cpp/message_type_support_decl.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "rosidl_typesupport_introspection_cpp/message_introspection.hpp" 7 | 8 | // NOLINTNEXTLINE 9 | class rosidl_message_type_support_t 10 | { 11 | public: 12 | const rosidl_typesupport_introspection_cpp::MessageMembers *data; 13 | }; 14 | -------------------------------------------------------------------------------- /test/unit/support/static-config-corrupt.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "networkInterfaces": ["FWE Corrupt File test"], 4 | "staticConfig": { 5 | "canInterface": ["FWE Corrupt File test"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/unit/support/static-config-inline-creds.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "networkInterfaces": [ 4 | { 5 | "canInterface": { 6 | "interfaceName": "vcan0", 7 | "protocolName": "CAN", 8 | "protocolVersion": "2.0A" 9 | }, 10 | "interfaceId": "1", 11 | "type": "canInterface" 12 | }, 13 | { 14 | "obdInterface": { 15 | "interfaceName": "vcan0", 16 | "obdStandard": "J1979", 17 | "pidRequestIntervalSeconds": 0, 18 | "dtcRequestIntervalSeconds": 0 19 | }, 20 | "interfaceId": "2", 21 | "type": "obdInterface" 22 | } 23 | ], 24 | "staticConfig": { 25 | "bufferSizes": { 26 | "dtcBufferSize": 100, 27 | "decodedSignalsBufferSize": 10000, 28 | "rawCANFrameBufferSize": 10000 29 | }, 30 | "threadIdleTimes": { 31 | "inspectionThreadIdleTimeMs": 50, 32 | "socketCANThreadIdleTimeMs": 50, 33 | "canDecoderThreadIdleTimeMs": 50 34 | }, 35 | "persistency": { 36 | "persistencyPath": "./", 37 | "persistencyPartitionMaxSize": 524288, 38 | "persistencyUploadRetryInterval": 10000 39 | }, 40 | "internalParameters": { 41 | "readyToPublishDataBufferSize": 10000, 42 | "systemWideLogLevel": "Trace" 43 | }, 44 | "publishToCloudParameters": { 45 | "maxPublishMessageCount": 1000, 46 | "collectionSchemeManagementCheckinIntervalMs": 5000 47 | }, 48 | "mqttConnection": { 49 | "endpointUrl": "my-endpoint.my-region.amazonaws.com", 50 | "clientId": "ClientId", 51 | "certificate": "MY_INLINE_CERTIFICATE", 52 | "privateKey": "MY_INLINE_PRIVATE_KEY", 53 | "rootCA": "MY_INLINE_ROOT_CA" 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /test/unit/support/test_module.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | bad_cleanup = False 4 | 5 | 6 | def invoke(val): 7 | global bad_cleanup 8 | print("Invoke: val: " + str(val)) 9 | if val is None: # Ignore undefined values 10 | return None 11 | if isinstance(val, str): 12 | return "abc" 13 | if isinstance(val, bool): 14 | return 0 15 | if val == 444: 16 | return True, {"Vehicle.BadSignal": "abc"} # Unknown signal 17 | if val == 555: 18 | return 0.0 19 | if val == 666: 20 | raise Exception("666 Exception") 21 | if val == 777: 22 | return (True,) # Tuple without data 23 | if val == 888: 24 | return (True, "Error message") # Tuple wrong datatype 25 | if val == 999: 26 | bad_cleanup = True 27 | return False 28 | if val >= 1000: 29 | ret = str(val * 2) 30 | print("Collected data: " + ret) 31 | return True, {"Vehicle.OutputSignal": ret} 32 | return False 33 | 34 | 35 | def cleanup(): 36 | print("Cleanup") 37 | if bad_cleanup: 38 | raise Exception("Cleanup Exception") 39 | -------------------------------------------------------------------------------- /test/unit/support/valgrind.supp: -------------------------------------------------------------------------------- 1 | { 2 | __libc_csu_init 3 | Memcheck:Leak 4 | match-leak-kinds: reachable 5 | ... 6 | fun:__libc_csu_init 7 | ... 8 | } 9 | { 10 | _dl_init 11 | Memcheck:Leak 12 | match-leak-kinds: reachable 13 | ... 14 | fun:_dl_init 15 | ... 16 | } 17 | { 18 | ion-c thread local table leak - https://github.com/amazon-ion/ion-c/issues/264 19 | Memcheck:Leak 20 | ... 21 | fun:_ion_writer_initialize_local_symbol_table 22 | ... 23 | } 24 | { 25 | PythonReachable 26 | Memcheck:Leak 27 | match-leak-kinds: reachable 28 | ... 29 | obj:*libpython3* 30 | ... 31 | } 32 | { 33 | PythonUninitialized 34 | Memcheck:Cond 35 | ... 36 | obj:*libpython3* 37 | ... 38 | } 39 | { 40 | PythonBadAccess 41 | Memcheck:Addr4 42 | ... 43 | obj:*libpython3* 44 | ... 45 | } 46 | { 47 | PythonBadAccess2 48 | Memcheck:Value8 49 | ... 50 | obj:*libpython3* 51 | ... 52 | } 53 | { 54 | PythonPossible 55 | Memcheck:Leak 56 | match-leak-kinds: possible 57 | ... 58 | obj:*libpython3* 59 | ... 60 | } 61 | { 62 | PythonPyThreadLock 63 | Memcheck:Leak 64 | match-leak-kinds: definite 65 | ... 66 | fun:PyThread_allocate_lock 67 | ... 68 | } 69 | { 70 | gmock static allocation with new - https://github.com/google/googletest/issues/4109 71 | Memcheck:Leak 72 | match-leak-kinds: reachable 73 | ... 74 | fun:*SetReactionOnUninterestingCalls* 75 | ... 76 | } 77 | -------------------------------------------------------------------------------- /tools/android-app/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | .DS_Store 6 | /captures 7 | .externalNativeBuild 8 | .cxx 9 | local.properties 10 | app/src/main/assets/THIRD-PARTY-LICENSES 11 | -------------------------------------------------------------------------------- /tools/android-app/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /src/main/jniLibs 3 | -------------------------------------------------------------------------------- /tools/android-app/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | namespace 'com.aws.iotfleetwise' 7 | compileSdk 33 8 | 9 | defaultConfig { 10 | applicationId "com.aws.iotfleetwise" 11 | minSdk 21 12 | targetSdk 33 13 | versionCode 1 14 | versionName "1.0" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | } 21 | } 22 | compileOptions { 23 | sourceCompatibility JavaVersion.VERSION_1_8 24 | targetCompatibility JavaVersion.VERSION_1_8 25 | } 26 | 27 | useLibrary 'android.car' 28 | } 29 | 30 | dependencies { 31 | implementation 'androidx.appcompat:appcompat:1.6.1' 32 | implementation 'com.google.android.material:material:1.9.0' 33 | implementation 'pub.devrel:easypermissions:3.0.0' 34 | } 35 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/assets/AmazonRootCA1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF 3 | ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 4 | b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL 5 | MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv 6 | b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj 7 | ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM 8 | 9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw 9 | IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6 10 | VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L 11 | 93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm 12 | jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC 13 | AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA 14 | A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI 15 | U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs 16 | N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv 17 | o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU 18 | 5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy 19 | rqXRfboQnoZsG4q5WTP468SQvvG5 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/java/com/aws/iotfleetwise/StatusEditTextPreference.java: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | package com.aws.iotfleetwise; 5 | 6 | import android.content.Context; 7 | import android.preference.EditTextPreference; 8 | import android.util.AttributeSet; 9 | import android.view.View; 10 | import android.widget.TextView; 11 | 12 | public class StatusEditTextPreference extends EditTextPreference { 13 | 14 | public StatusEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 15 | super(context, attrs, defStyleAttr, defStyleRes); 16 | } 17 | 18 | public StatusEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr) { 19 | super(context, attrs, defStyleAttr); 20 | } 21 | 22 | public StatusEditTextPreference(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | } 25 | 26 | public StatusEditTextPreference(Context context) { 27 | super(context); 28 | } 29 | 30 | @Override 31 | protected void onBindView(View view) { 32 | super.onBindView(view); 33 | TextView summary = (TextView)view.findViewById(android.R.id.summary); 34 | summary.setMaxLines(20); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/res/layout/activity_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 23 | 24 | 34 | 35 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/res/layout/activity_bluetooth_device_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/res/layout/activity_configure_vehicle.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 23 | 24 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/res/layout/bluetooth_device.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/tools/android-app/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /tools/android-app/app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #C5E1A5 4 | #8BC34A 5 | #689F38 6 | #FFCC80 7 | #F57C00 8 | #FF000000 9 | #FFFFFFFF 10 | 11 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FWE 3 | Configure vehicle 4 | Use your QR code scanner app to scan a provisioning QR code.\n\nAlternatively paste a provisioning link below: 5 | Provisioning link 6 | Bluetooth device list 7 | Vehicle configuration 8 | Update time [seconds] 9 | Status 10 | Bluetooth device 11 | 5 12 | About 13 | Open source licenses: 14 | Learn more about AWS IoT FleetWise at:\nhttps://github.com/aws/aws-iot-fleetwise-edge 15 | 16 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | -------------------------------------------------------------------------------- /tools/android-app/app/src/main/res/xml/preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /tools/android-app/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | plugins { 3 | id 'com.android.application' version '7.3.1' apply false 4 | id 'com.android.library' version '7.3.1' apply false 5 | } 6 | -------------------------------------------------------------------------------- /tools/android-app/cloud/.gitignore: -------------------------------------------------------------------------------- 1 | config/ 2 | aaos-vhal-types.h 3 | aaos-vhal-fqns.txt 4 | fwdemo-android-*-timestream-result.json 5 | demo.env 6 | -------------------------------------------------------------------------------- /tools/android-app/cloud/network-interface-custom-aaos-vhal.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "AAOS-VHAL", 4 | "type": "CUSTOM_DECODING_INTERFACE", 5 | "customDecodingInterface": { 6 | "name": "AaosVhalInterface" 7 | } 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /tools/android-app/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Enables namespacing of each library's R class so that its R class includes only the 19 | # resources declared in the library itself and none from the library's dependencies, 20 | # thereby reducing the size of the R class for that library 21 | android.nonTransitiveRClass=true 22 | -------------------------------------------------------------------------------- /tools/android-app/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-iot-fleetwise-edge/a7e4fe62f13e83840c62601ea848d991e703e2b8/tools/android-app/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /tools/android-app/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Apr 27 16:03:33 CEST 2023 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /tools/android-app/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | } 15 | rootProject.name = "FWE" 16 | include ':app' 17 | -------------------------------------------------------------------------------- /tools/arm64-toolchain.cmake: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | set(CMAKE_SYSTEM_NAME Linux) 4 | set(CMAKE_SYSTEM_PROCESSOR aarch64) 5 | set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) 6 | set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) 7 | set(CMAKE_FIND_ROOT_PATH "/usr/local/aarch64-linux-gnu") 8 | set(PKG_CONFIG_EXECUTABLE "/usr/bin/aarch64-linux-gnu-pkg-config") 9 | # During cross-compilation, CMake cannot execute TRY_RUN tests since the compiled binary 10 | # would be for the target architecture (ARM) rather than the host system. These cache 11 | # variables provide pre-set values to bypass the actual execution of tests: 12 | # - SM_RUN_RESULT: Set to "FAILED_TO_RUN" as expected by project dependencies 13 | # - SM_RUN_RESULT__TRYRUN_OUTPUT: Set to "NOTFOUND" for expected behavior 14 | set( SM_RUN_RESULT 15 | "FAILED_TO_RUN" 16 | CACHE STRING "Result from TRY_RUN" FORCE) 17 | 18 | set( SM_RUN_RESULT__TRYRUN_OUTPUT 19 | "NOTFOUND" 20 | CACHE STRING "Output from TRY_RUN" FORCE) 21 | -------------------------------------------------------------------------------- /tools/arm64.list: -------------------------------------------------------------------------------- 1 | deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe multiverse 2 | deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe multiverse 3 | deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse 4 | deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse 5 | -------------------------------------------------------------------------------- /tools/armhf-toolchain.cmake: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | set(CMAKE_SYSTEM_NAME Linux) 4 | set(CMAKE_SYSTEM_PROCESSOR arm) 5 | set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) 6 | set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) 7 | set(CMAKE_FIND_ROOT_PATH "/usr/local/arm-linux-gnueabihf") 8 | set(PKG_CONFIG_EXECUTABLE "/usr/bin/arm-linux-gnueabihf-pkg-config") 9 | set(CMAKE_CXX_FLAGS "" CACHE INTERNAL "") 10 | set(CMAKE_C_FLAGS "" CACHE INTERNAL "") 11 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi") 12 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi") 13 | # During cross-compilation, CMake cannot execute TRY_RUN tests since the compiled binary 14 | # would be for the target architecture (ARM) rather than the host system. These cache 15 | # variables provide pre-set values to bypass the actual execution of tests: 16 | # - SM_RUN_RESULT: Set to "FAILED_TO_RUN" as expected by project dependencies 17 | # - SM_RUN_RESULT__TRYRUN_OUTPUT: Set to "NOTFOUND" for expected behavior 18 | set( SM_RUN_RESULT 19 | "FAILED_TO_RUN" 20 | CACHE STRING "Result from TRY_RUN" FORCE) 21 | 22 | set( SM_RUN_RESULT__TRYRUN_OUTPUT 23 | "NOTFOUND" 24 | CACHE STRING "Output from TRY_RUN" FORCE) 25 | -------------------------------------------------------------------------------- /tools/armhf.list: -------------------------------------------------------------------------------- 1 | deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe multiverse 2 | deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe multiverse 3 | deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse 4 | deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse 5 | -------------------------------------------------------------------------------- /tools/build-dist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -euo pipefail 6 | 7 | if (($#<1)); then 8 | echo "Error: Output files not provided" >&2 9 | exit -1 10 | fi 11 | 12 | rm -rf build/dist 13 | mkdir build/dist 14 | cd build/dist 15 | 16 | for FILE in $@; do 17 | SRC=`echo $FILE | cut -d ':' -f1` 18 | DEST=`echo $FILE | cut -d ':' -f2` 19 | mkdir -p $DEST 20 | cp -r ../../$SRC $DEST 21 | done 22 | 23 | cp -r ../../LICENSE \ 24 | ../../THIRD-PARTY-LICENSES \ 25 | ../../configuration \ 26 | ../../tools \ 27 | . 28 | rm -rf tools/android-app 29 | 30 | tar -zcf ../aws-iot-fleetwise-edge.tar.gz * 31 | -------------------------------------------------------------------------------- /tools/can-to-someip/.gitignore: -------------------------------------------------------------------------------- 1 | can-to-someip 2 | -------------------------------------------------------------------------------- /tools/can-to-someip/README.md: -------------------------------------------------------------------------------- 1 | # CAN to SOME/IP 2 | 3 | There are two versions of this tool provided: one written in Python `can-to-someip.py` using 4 | [pysomeip](https://github.com/afflux/pysomeip) and one written in C++ using 5 | [vsomeip](https://github.com/COVESA/vsomeip). 6 | 7 | Using the C++ version may be desirable if the UNIX domain socket functionality of `vsomeip` is 8 | required. 9 | -------------------------------------------------------------------------------- /tools/can-to-someip/can-to-someip.cmake: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | add_executable(can-to-someip 4 | tools/can-to-someip/main.cpp 5 | ) 6 | 7 | install(TARGETS can-to-someip 8 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 9 | ) 10 | 11 | target_include_directories(can-to-someip PUBLIC 12 | ${VSOMEIP_INCLUDE_DIR} 13 | ) 14 | 15 | target_link_libraries(can-to-someip 16 | ${VSOMEIP_LIBRARIES} 17 | Boost::system 18 | Boost::thread 19 | Boost::filesystem 20 | Boost::program_options 21 | ) 22 | -------------------------------------------------------------------------------- /tools/cansim/cansim@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=CAN Simulator #%i 3 | After=setup-socketcan.service 4 | Wants=setup-socketcan.service 5 | 6 | [Service] 7 | Restart=always 8 | RestartSec=1 9 | ExecStart=/bin/bash /usr/share/cansim/run-cansim.sh %i 10 | WorkingDirectory=/usr/share/cansim 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /tools/cansim/hscan.dbc: -------------------------------------------------------------------------------- 1 | VERSION "" 2 | 3 | NS_ : 4 | NS_DESC_ 5 | CM_ 6 | BA_DEF_ 7 | BA_ 8 | VAL_ 9 | CAT_DEF_ 10 | CAT_ 11 | FILTER 12 | BA_DEF_DEF_ 13 | EV_DATA_ 14 | ENVVAR_DATA_ 15 | SGTYPE_ 16 | SGTYPE_VAL_ 17 | BA_DEF_SGTYPE_ 18 | BA_SGTYPE_ 19 | SIG_TYPE_REF_ 20 | VAL_TABLE_ 21 | SIG_GROUP_ 22 | SIG_VALTYPE_ 23 | SIGTYPE_VALTYPE_ 24 | BO_TX_BU_ 25 | BA_DEF_REL_ 26 | BA_REL_ 27 | BA_DEF_DEF_REL_ 28 | BU_SG_REL_ 29 | BU_EV_REL_ 30 | BU_BO_REL_ 31 | 32 | BS_: 33 | 34 | BU_: 35 | 36 | BO_ 769 Connectivity: 1 Vector__XXX 37 | SG_ NetworkType : 7|8@0+ (1,0) [0|3] "" Vector__XXX 38 | 39 | BO_ 401 ECM: 8 Vector__XXX 40 | SG_ DemoEngineTorque : 3|12@0+ (0.5,-848) [-848|1199.5] "Nm" Vector__XXX 41 | 42 | BO_ 532 ABS: 6 Vector__XXX 43 | SG_ DemoBrakePedalPressure : 0|8@0+ (75,0) [0|19125] "kPa" Vector__XXX 44 | 45 | BO_ 1217 BCM: 8 Vector__XXX 46 | SG_ DemoEngineCoolantTemperature : 23|8@0+ (1,-40) [-40|215] "deg C" Vector__XXX 47 | 48 | BO_ 1343 VEI: 6 Vector__XXX 49 | SG_ DemoSpeed : 3|32@1+ (1,0) [-300.0|300.0] "km / h" Vector__XXX 50 | 51 | BO_ 1452 BMS: 8 Vector__XXX 52 | SG_ DemoVoltage : 7|64@0+ (1,0) [0.0|192.0] "V" Vector__XXX 53 | 54 | BA_DEF_ SG_ "SignalType" STRING ; 55 | BA_DEF_ SG_ "SignalLongName" STRING ; 56 | BA_DEF_ BO_ "GenMsgCycleTime" INT 0 10000; 57 | BA_DEF_DEF_ "SignalType" ""; 58 | BA_DEF_DEF_ "SignalLongName" ""; 59 | BA_DEF_DEF_ "GenMsgCycleTime" 0; 60 | BA_ "GenMsgCycleTime" BO_ 769 1000; 61 | BA_ "GenMsgCycleTime" BO_ 401 12; 62 | BA_ "GenMsgCycleTime" BO_ 532 50; 63 | BA_ "GenMsgCycleTime" BO_ 1217 500; 64 | BA_ "GenMsgCycleTime" BO_ 1343 50; 65 | BA_ "GenMsgCycleTime" BO_ 1452 50; 66 | 67 | SIG_VALTYPE_ 1343 DemoSpeed : 1; 68 | SIG_VALTYPE_ 1452 DemoVoltage : 2; 69 | -------------------------------------------------------------------------------- /tools/cansim/run-cansim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -euo pipefail 6 | 7 | if (($#<1)); then 8 | echo "Error: Instance number not provided" >&2 9 | exit -1 10 | fi 11 | 12 | # In order to reduce the CAN simulation overhead for a large fleet of vehicles, generation of CAN 13 | # bus messages for CAN signals is only performed on vcan0, then frames are forwarded to all of the 14 | # other buses using `cangw`. Simulation of the OBD server is however performed on every channel. 15 | 16 | # If the instance number is greater than zero check whether the forwarding rule is already applied: 17 | if (($1>0)) && ! cangw -L | grep -q "cangw -A -s vcan0 -d vcan$1 -e"; then 18 | # If not, add a forwarding rule from vcan0 to this bus, excluding diagnostic frames: 19 | cangw -A -s "vcan0" -d "vcan$1" -e -f "700~C0000700" 20 | fi 21 | 22 | # Start the CAN simulator: for instance numbers greater than zero, only OBD is simulated 23 | /usr/bin/python3 /usr/share/cansim/cansim.py --interface "vcan$1" `(($1>0)) && echo "--only-obd"` 24 | -------------------------------------------------------------------------------- /tools/cloud/.gitignore: -------------------------------------------------------------------------------- 1 | s3-bucket-policy.json 2 | demo.env 3 | collected-data-* 4 | ros2-nodes.json 5 | ros2-decoders.json 6 | last_known_state_message_pb2.py 7 | can-nodes.json 8 | can-decoders.json 9 | -------------------------------------------------------------------------------- /tools/cloud/README.md: -------------------------------------------------------------------------------- 1 | # AWS IoT FleetWise Cloud Demo Script 2 | 3 | ## Prerequisites 4 | 5 | The demo applies for Python 3.8+ environment. Install the dependencies: 6 | 7 | ```bash 8 | sudo ./install-deps.sh 9 | ``` 10 | 11 | ## Running the Demo 12 | 13 | Run the demo: 14 | 15 | ```bash 16 | ./demo.sh 17 | ``` 18 | -------------------------------------------------------------------------------- /tools/cloud/campaign-brake-event-vision-system-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "diagnosticsMode": "OFF", 4 | "spoolingMode": "TO_DISK", 5 | "collectionScheme": { 6 | "conditionBasedCollectionScheme": { 7 | "conditionLanguageVersion": 1, 8 | "expression": "$variable.`Vehicle.ABS.DemoBrakePedalPressure` > 7000", 9 | "minimumTriggerIntervalMs": 1000, 10 | "triggerMode": "ALWAYS" 11 | } 12 | }, 13 | "postTriggerCollectionDuration": 1000, 14 | "signalsToCollect": [ 15 | { 16 | "name": "Vehicle.ECM.DemoEngineTorque" 17 | }, 18 | { 19 | "name": "Vehicle.ABS.DemoBrakePedalPressure" 20 | }, 21 | { 22 | "name": "Vehicle.Cameras.Front.Image" 23 | }, 24 | { 25 | "name": "Vehicle.Speed" 26 | }, 27 | { 28 | "name": "Vehicle.Airbag.CollisionIntensity" 29 | }, 30 | { 31 | "name": "Vehicle.Acceleration" 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /tools/cloud/campaign-brake-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "diagnosticsMode": "OFF", 4 | "spoolingMode": "TO_DISK", 5 | "collectionScheme": { 6 | "conditionBasedCollectionScheme": { 7 | "conditionLanguageVersion": 1, 8 | "expression": "$variable.`Vehicle.ABS.DemoBrakePedalPressure` > 7000", 9 | "minimumTriggerIntervalMs": 1000, 10 | "triggerMode": "ALWAYS" 11 | } 12 | }, 13 | "postTriggerCollectionDuration": 1000, 14 | "signalsToCollect": [ 15 | { 16 | "name": "Vehicle.ECM.DemoEngineTorque" 17 | }, 18 | { 19 | "name": "Vehicle.ABS.DemoBrakePedalPressure" 20 | }, 21 | { 22 | "name": "Vehicle.VEI.DemoSpeed" 23 | }, 24 | { 25 | "name": "Vehicle.BMS.DemoVoltage" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /tools/cloud/campaign-math.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "collectionScheme": { 4 | "conditionBasedCollectionScheme": { 5 | "conditionLanguageVersion": 1, 6 | "expression": "custom_function('pow', custom_function('pow', $variable.`Vehicle.ECM.DemoEngineTorque`, 2) + custom_function('pow', $variable.`Vehicle.ABS.DemoBrakePedalPressure`, 2), 0.5) > 100", 7 | "triggerMode": "RISING_EDGE" 8 | } 9 | }, 10 | "signalsToCollect": [ 11 | { 12 | "name": "Vehicle.ECM.DemoEngineTorque" 13 | }, 14 | { 15 | "name": "Vehicle.ABS.DemoBrakePedalPressure" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tools/cloud/campaign-multi-rising-edge-trigger.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "collectionScheme": { 4 | "conditionBasedCollectionScheme": { 5 | "conditionLanguageVersion": 1, 6 | "expression": "custom_function('MULTI_RISING_EDGE_TRIGGER', 'ALARM1', $variable.`Vehicle.ECM.DemoEngineTorque` > 500, 'ALARM2', $variable.`Vehicle.ABS.DemoBrakePedalPressure` > 7000)", 7 | "triggerMode": "ALWAYS" 8 | } 9 | }, 10 | "signalsToCollect": [ 11 | { 12 | "name": "Vehicle.MultiRisingEdgeTrigger" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tools/cloud/campaign-obd-and-location-heartbeat.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "diagnosticsMode": "SEND_ACTIVE_DTCS", 4 | "spoolingMode": "TO_DISK", 5 | "collectionScheme": { 6 | "timeBasedCollectionScheme": { 7 | "periodMs": 10000 8 | } 9 | }, 10 | "signalsToCollect": [ 11 | { 12 | "name": "Vehicle.OBD.EngineSpeed" 13 | }, 14 | { 15 | "name": "Vehicle.OBD.Speed" 16 | }, 17 | { 18 | "name": "Vehicle.OBD.AmbientAirTemperature" 19 | }, 20 | { 21 | "name": "Vehicle.OBD.EngineCoolantTemperature" 22 | }, 23 | { 24 | "name": "Vehicle.OBD.ThrottlePosition" 25 | }, 26 | { 27 | "name": "Vehicle.OBD.FuelLevel" 28 | }, 29 | { 30 | "name": "Vehicle.CurrentLocation.Latitude" 31 | }, 32 | { 33 | "name": "Vehicle.CurrentLocation.Longitude" 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /tools/cloud/campaign-obd-heartbeat.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "diagnosticsMode": "SEND_ACTIVE_DTCS", 4 | "spoolingMode": "TO_DISK", 5 | "collectionScheme": { 6 | "timeBasedCollectionScheme": { 7 | "periodMs": 10000 8 | } 9 | }, 10 | "signalsToCollect": [ 11 | { 12 | "name": "Vehicle.OBD.EngineSpeed" 13 | }, 14 | { 15 | "name": "Vehicle.OBD.Speed" 16 | }, 17 | { 18 | "name": "Vehicle.OBD.AmbientAirTemperature" 19 | }, 20 | { 21 | "name": "Vehicle.OBD.EngineCoolantTemperature" 22 | }, 23 | { 24 | "name": "Vehicle.OBD.ThrottlePosition" 25 | }, 26 | { 27 | "name": "Vehicle.OBD.FuelLevel" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /tools/cloud/campaign-python-histogram.json: -------------------------------------------------------------------------------- 1 | { 2 | "collectionScheme": { 3 | "conditionBasedCollectionScheme": { 4 | "conditionLanguageVersion": 1, 5 | "expression": "custom_function('python', 'custom-function-python-histogram', 'histogram', $variable.`Vehicle.ECM.DemoEngineTorque`)", 6 | "triggerMode": "ALWAYS" 7 | } 8 | }, 9 | "signalsToCollect": [ 10 | { 11 | "name": "Vehicle.Histogram" 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /tools/cloud/campaign-someip-heartbeat.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "spoolingMode": "TO_DISK", 4 | "collectionScheme": { 5 | "timeBasedCollectionScheme": { 6 | "periodMs": 10000 7 | } 8 | }, 9 | "signalsToCollect": [ 10 | { 11 | "name": "Vehicle.ExampleSomeipInterface.X" 12 | }, 13 | { 14 | "name": "Vehicle.ExampleSomeipInterface.A1.A2.A" 15 | }, 16 | { 17 | "name": "Vehicle.ExampleSomeipInterface.A1.A2.B" 18 | }, 19 | { 20 | "name": "Vehicle.ExampleSomeipInterface.A1.A2.D" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /tools/cloud/campaign-store-only-no-upload.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "diagnosticsMode": "OFF", 4 | "spoolingMode": "TO_DISK", 5 | "collectionScheme": { 6 | "timeBasedCollectionScheme": { 7 | "periodMs": 10000 8 | } 9 | }, 10 | "postTriggerCollectionDuration": 1000, 11 | "signalsToCollect": [ 12 | { 13 | "name": "Vehicle.ECM.DemoEngineTorque", 14 | "dataPartitionId": "engine" 15 | } 16 | ], 17 | "dataPartitions": [ 18 | { 19 | "id": "engine", 20 | "storageOptions": { 21 | "maximumSize": { 22 | "unit": "MB", 23 | "value": 10 24 | }, 25 | "storageLocation": "engine_data", 26 | "minimumTimeToLive": { 27 | "unit": "DAYS", 28 | "value": 7 29 | } 30 | } 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /tools/cloud/campaign-uds-dtc-condition-based-fetch.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "spoolingMode": "TO_DISK", 4 | "signalsToFetch": [ 5 | { 6 | "fullyQualifiedName": "Vehicle.ECU1.DTC_INFO", 7 | "signalFetchConfig": { 8 | "conditionBased": { 9 | "conditionExpression": "$variable.`Vehicle.ECM.DemoEngineTorque` > 890", 10 | "triggerMode": "ALWAYS" 11 | } 12 | }, 13 | "actions": ["custom_function(\"DTC_QUERY\", -1, 4, -1)"] 14 | } 15 | ], 16 | "signalsToCollect": [ 17 | { 18 | "name": "Vehicle.ECU1.DTC_INFO" 19 | }, 20 | { 21 | "name": "Vehicle.ECM.DemoEngineTorque" 22 | } 23 | ], 24 | "collectionScheme": { 25 | "timeBasedCollectionScheme": { 26 | "periodMs": 10000 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tools/cloud/campaign-uds-dtc-time-based-fetch.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "spoolingMode": "TO_DISK", 4 | "signalsToFetch": [ 5 | { 6 | "fullyQualifiedName": "Vehicle.ECU1.DTC_INFO", 7 | "signalFetchConfig": { 8 | "timeBased": { 9 | "executionFrequencyMs": 5000 10 | } 11 | }, 12 | "actions": [ 13 | "custom_function(\"DTC_QUERY\", -1, 4, -1)", 14 | "custom_function(\"DTC_QUERY\", -1, 6, -1)" 15 | ] 16 | } 17 | ], 18 | "signalsToCollect": [ 19 | { 20 | "name": "Vehicle.ECU1.DTC_INFO" 21 | } 22 | ], 23 | "collectionScheme": { 24 | "conditionBasedCollectionScheme": { 25 | "conditionLanguageVersion": 1, 26 | "expression": "!isNull($variable.`Vehicle.ECU1.DTC_INFO`)", 27 | "minimumTriggerIntervalMs": 1000, 28 | "triggerMode": "ALWAYS" 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tools/cloud/campaign-upload-critical-during-hard-braking.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "diagnosticsMode": "OFF", 4 | "spoolingMode": "TO_DISK", 5 | "collectionScheme": { 6 | "timeBasedCollectionScheme": { 7 | "periodMs": 10000 8 | } 9 | }, 10 | "postTriggerCollectionDuration": 1000, 11 | "signalsToCollect": [ 12 | { 13 | "name": "Vehicle.ABS.DemoBrakePedalPressure", 14 | "dataPartitionId": "critical" 15 | } 16 | ], 17 | "dataPartitions": [ 18 | { 19 | "id": "critical", 20 | "storageOptions": { 21 | "maximumSize": { 22 | "unit": "MB", 23 | "value": 10 24 | }, 25 | "storageLocation": "critical_data", 26 | "minimumTimeToLive": { 27 | "unit": "DAYS", 28 | "value": 7 29 | } 30 | }, 31 | "uploadOptions": { "expression": "$variable.`Vehicle.ABS.DemoBrakePedalPressure` > 7000" } 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /tools/cloud/campaign-upload-during-wifi.json: -------------------------------------------------------------------------------- 1 | { 2 | "compression": "SNAPPY", 3 | "diagnosticsMode": "OFF", 4 | "spoolingMode": "TO_DISK", 5 | "collectionScheme": { 6 | "timeBasedCollectionScheme": { 7 | "periodMs": 30000 8 | } 9 | }, 10 | "postTriggerCollectionDuration": 1000, 11 | "signalsToCollect": [ 12 | { 13 | "name": "Vehicle.Connectivity.NetworkType", 14 | "dataPartitionId": "basic" 15 | } 16 | ], 17 | "dataPartitions": [ 18 | { 19 | "id": "basic", 20 | "storageOptions": { 21 | "maximumSize": { 22 | "unit": "MB", 23 | "value": 10 24 | }, 25 | "storageLocation": "basic_data", 26 | "minimumTimeToLive": { 27 | "unit": "DAYS", 28 | "value": 7 29 | } 30 | }, 31 | "uploadOptions": { "expression": "$variable.`Vehicle.Connectivity.NetworkType` == 1" } 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /tools/cloud/custom-decoders-can-actuators.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.actuator6", 4 | "interfaceId": "CAN_ACTUATORS", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "Vehicle.actuator6" 8 | } 9 | }, 10 | { 11 | "fullyQualifiedName": "Vehicle.actuator7", 12 | "interfaceId": "CAN_ACTUATORS", 13 | "type": "CUSTOM_DECODING_SIGNAL", 14 | "customDecodingSignal": { 15 | "id": "Vehicle.actuator7" 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /tools/cloud/custom-decoders-histogram.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.Histogram", 4 | "interfaceId": "NAMED_SIGNAL", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "Vehicle.Histogram" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /tools/cloud/custom-decoders-location.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.CurrentLocation.Longitude", 4 | "interfaceId": "LOCATION", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "Vehicle.CurrentLocation.Longitude" 8 | } 9 | }, 10 | { 11 | "fullyQualifiedName": "Vehicle.CurrentLocation.Latitude", 12 | "interfaceId": "LOCATION", 13 | "type": "CUSTOM_DECODING_SIGNAL", 14 | "customDecodingSignal": { 15 | "id": "Vehicle.CurrentLocation.Latitude" 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /tools/cloud/custom-decoders-multi-rising-edge-trigger.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.MultiRisingEdgeTrigger", 4 | "interfaceId": "NAMED_SIGNAL", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "Vehicle.MultiRisingEdgeTrigger" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /tools/cloud/custom-decoders-uds-dtc.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "fullyQualifiedName": "Vehicle.ECU1.DTC_INFO", 4 | "interfaceId": "UDS_DTC", 5 | "type": "CUSTOM_DECODING_SIGNAL", 6 | "customDecodingSignal": { 7 | "id": "Vehicle.ECU1.DTC_INFO" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /tools/cloud/custom-function-python-histogram/histogram.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | import json 4 | 5 | 6 | class Histogram: 7 | def __init__(self, min_val, max_val, num_bins): 8 | self.min_val = min_val 9 | self.max_val = max_val 10 | self.num_bins = num_bins 11 | self.reset() 12 | 13 | def calc(self, val): 14 | if val <= self.min_val: 15 | bin_idx = 0 16 | elif val >= self.max_val: 17 | bin_idx = self.num_bins - 1 18 | else: 19 | bin_idx = int( 20 | (val - self.min_val) * (self.num_bins - 1) / (self.max_val - self.min_val) 21 | ) 22 | self.bins[bin_idx] += 1 23 | self.sample_count += 1 24 | 25 | def reset(self): 26 | self.sample_count = 0 27 | self.bins = [0] * self.num_bins 28 | 29 | 30 | hist = Histogram(min_val=-1000, max_val=1000, num_bins=100) 31 | 32 | 33 | def invoke(val): 34 | global hist 35 | if val is None: # Ignore undefined values 36 | return False 37 | hist.calc(val) 38 | 39 | # Collect data every 1000 samples: 40 | if hist.sample_count >= 1000: 41 | json_result = json.dumps(hist.bins) 42 | hist.reset() 43 | 44 | # Collected data can be returned as the second value in a tuple: 45 | return True, {"Vehicle.Histogram": json_result} 46 | 47 | return False 48 | -------------------------------------------------------------------------------- /tools/cloud/custom-nodes-can-actuators.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "actuator": { 4 | "fullyQualifiedName": "Vehicle.actuator6", 5 | "description": "Vehicle actuator6", 6 | "dataType": "INT32" 7 | } 8 | }, 9 | { 10 | "actuator": { 11 | "fullyQualifiedName": "Vehicle.actuator7", 12 | "description": "Vehicle actuator7", 13 | "dataType": "DOUBLE" 14 | } 15 | } 16 | ] 17 | -------------------------------------------------------------------------------- /tools/cloud/custom-nodes-histogram.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "branch": { 4 | "fullyQualifiedName": "Vehicle", 5 | "description": "Vehicle" 6 | } 7 | }, 8 | { 9 | "sensor": { 10 | "fullyQualifiedName": "Vehicle.Histogram", 11 | "description": "Vehicle.Histogram", 12 | "dataType": "STRING" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /tools/cloud/custom-nodes-location.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "branch": { 4 | "fullyQualifiedName": "Vehicle.CurrentLocation", 5 | "description": "CurrentLocation" 6 | } 7 | }, 8 | { 9 | "sensor": { 10 | "dataType": "DOUBLE", 11 | "fullyQualifiedName": "Vehicle.CurrentLocation.Latitude", 12 | "description": "Latitude" 13 | } 14 | }, 15 | { 16 | "sensor": { 17 | "dataType": "DOUBLE", 18 | "fullyQualifiedName": "Vehicle.CurrentLocation.Longitude", 19 | "description": "Longitude" 20 | } 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /tools/cloud/custom-nodes-multi-rising-edge-trigger.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "branch": { 4 | "fullyQualifiedName": "Vehicle", 5 | "description": "Vehicle" 6 | } 7 | }, 8 | { 9 | "sensor": { 10 | "fullyQualifiedName": "Vehicle.MultiRisingEdgeTrigger", 11 | "description": "Vehicle.MultiRisingEdgeTrigger", 12 | "dataType": "STRING" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /tools/cloud/custom-nodes-uds-dtc.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "branch": { 4 | "fullyQualifiedName": "Vehicle", 5 | "description": "Vehicle" 6 | } 7 | }, 8 | { 9 | "branch": { 10 | "fullyQualifiedName": "Vehicle.ECU1", 11 | "description": "Vehicle.ECU1" 12 | } 13 | }, 14 | { 15 | "sensor": { 16 | "fullyQualifiedName": "Vehicle.ECU1.DTC_INFO", 17 | "description": "Vehicle.ECU1.DTC_INFO", 18 | "dataType": "STRING" 19 | } 20 | } 21 | ] 22 | -------------------------------------------------------------------------------- /tools/cloud/hscan.dbc: -------------------------------------------------------------------------------- 1 | VERSION "" 2 | 3 | NS_ : 4 | NS_DESC_ 5 | CM_ 6 | BA_DEF_ 7 | BA_ 8 | VAL_ 9 | CAT_DEF_ 10 | CAT_ 11 | FILTER 12 | BA_DEF_DEF_ 13 | EV_DATA_ 14 | ENVVAR_DATA_ 15 | SGTYPE_ 16 | SGTYPE_VAL_ 17 | BA_DEF_SGTYPE_ 18 | BA_SGTYPE_ 19 | SIG_TYPE_REF_ 20 | VAL_TABLE_ 21 | SIG_GROUP_ 22 | SIG_VALTYPE_ 23 | SIGTYPE_VALTYPE_ 24 | BO_TX_BU_ 25 | BA_DEF_REL_ 26 | BA_REL_ 27 | BA_DEF_DEF_REL_ 28 | BU_SG_REL_ 29 | BU_EV_REL_ 30 | BU_BO_REL_ 31 | 32 | BS_: 33 | 34 | BU_: 35 | 36 | BO_ 769 Connectivity: 1 Vector__XXX 37 | SG_ NetworkType : 7|8@0+ (1,0) [0|3] "" Vector__XXX 38 | 39 | BO_ 401 ECM: 8 Vector__XXX 40 | SG_ DemoEngineTorque : 3|12@0+ (0.5,-848) [-848|1199.5] "Nm" Vector__XXX 41 | 42 | BO_ 532 ABS: 6 Vector__XXX 43 | SG_ DemoBrakePedalPressure : 0|8@0+ (75,0) [0|19125] "kPa" Vector__XXX 44 | 45 | BO_ 1217 BCM: 8 Vector__XXX 46 | SG_ DemoEngineCoolantTemperature : 23|8@0+ (1,-40) [-40|215] "deg C" Vector__XXX 47 | 48 | BO_ 1343 VEI: 6 Vector__XXX 49 | SG_ DemoSpeed : 3|32@1+ (1,0) [-300.0|300.0] "km / h" Vector__XXX 50 | 51 | BO_ 1452 BMS: 8 Vector__XXX 52 | SG_ DemoVoltage : 7|64@0+ (1,0) [0.0|192.0] "V" Vector__XXX 53 | 54 | BA_DEF_ SG_ "SignalType" STRING ; 55 | BA_DEF_ SG_ "SignalLongName" STRING ; 56 | BA_DEF_ BO_ "GenMsgCycleTime" INT 0 10000; 57 | BA_DEF_DEF_ "SignalType" ""; 58 | BA_DEF_DEF_ "SignalLongName" ""; 59 | BA_DEF_DEF_ "GenMsgCycleTime" 0; 60 | BA_ "GenMsgCycleTime" BO_ 769 1000; 61 | BA_ "GenMsgCycleTime" BO_ 401 12; 62 | BA_ "GenMsgCycleTime" BO_ 532 50; 63 | BA_ "GenMsgCycleTime" BO_ 1217 500; 64 | BA_ "GenMsgCycleTime" BO_ 1343 50; 65 | BA_ "GenMsgCycleTime" BO_ 1452 50; 66 | 67 | SIG_VALTYPE_ 1343 DemoSpeed : 1; 68 | SIG_VALTYPE_ 1452 DemoVoltage : 2; 69 | -------------------------------------------------------------------------------- /tools/cloud/install-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -eo pipefail 6 | 7 | # On Ubuntu install Python 3 and pip 8 | if command -v apt &> /dev/null; then 9 | apt-get update 10 | apt-get install -y python3 python3-pip 11 | fi 12 | 13 | # Install pip packages 14 | # Note: CloudShell currently only supports pyarrow 12.0.1 15 | 16 | python3 -m pip install importlib_metadata==8.5.0 17 | 18 | python3 -m pip install \ 19 | wrapt==1.10.0 \ 20 | plotly==5.3.1 \ 21 | pandas==2.1.4 \ 22 | cantools==36.4.0 \ 23 | pyarrow==12.0.1 \ 24 | boto3==1.20.34 \ 25 | protobuf==3.20.2 \ 26 | awsiotsdk==1.17.0 \ 27 | packaging==24.0 28 | -------------------------------------------------------------------------------- /tools/cloud/network-interface-can.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "1", 4 | "type": "CAN_INTERFACE", 5 | "canInterface": { 6 | "name": "can0", 7 | "protocolName": "CAN", 8 | "protocolVersion": "2.0B" 9 | } 10 | } 11 | ] 12 | -------------------------------------------------------------------------------- /tools/cloud/network-interface-custom-can-actuators.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "CAN_ACTUATORS", 4 | "type": "CUSTOM_DECODING_INTERFACE", 5 | "customDecodingInterface": { 6 | "name": "NamedSignalInterface" 7 | } 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /tools/cloud/network-interface-custom-location.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "LOCATION", 4 | "type": "CUSTOM_DECODING_INTERFACE", 5 | "customDecodingInterface": { 6 | "name": "NamedSignalInterface" 7 | } 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /tools/cloud/network-interface-custom-named-signal.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "NAMED_SIGNAL", 4 | "type": "CUSTOM_DECODING_INTERFACE", 5 | "customDecodingInterface": { 6 | "name": "NamedSignalInterface" 7 | } 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /tools/cloud/network-interface-custom-someip.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "SOMEIP", 4 | "type": "CUSTOM_DECODING_INTERFACE", 5 | "customDecodingInterface": { 6 | "name": "NamedSignalInterface" 7 | } 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /tools/cloud/network-interface-custom-uds-dtc.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "UDS_DTC", 4 | "type": "CUSTOM_DECODING_INTERFACE", 5 | "customDecodingInterface": { 6 | "name": "NamedSignalInterface" 7 | } 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /tools/cloud/network-interface-obd.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "0", 4 | "type": "OBD_INTERFACE", 5 | "obdInterface": { 6 | "name": "can0", 7 | "requestMessageId": 2015, 8 | "obdStandard": "J1979", 9 | "pidRequestIntervalSeconds": 5, 10 | "dtcRequestIntervalSeconds": 5 11 | } 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /tools/cloud/network-interface-ros2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaceId": "10", 4 | "type": "VEHICLE_MIDDLEWARE", 5 | "vehicleMiddleware": { 6 | "name": "ros2", 7 | "protocolName": "ROS_2" 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /tools/cloud/ros2-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "messages": [ 3 | { 4 | "fullyQualifiedName": "Vehicle.Cameras.Front.Image", 5 | "interfaceId": "10", 6 | "topic": "/carla/ego_vehicle/rgb_front/image_compressed", 7 | "type": "sensor_msgs/msg/CompressedImage" 8 | }, 9 | { 10 | "fullyQualifiedName": "Vehicle.Speed", 11 | "interfaceId": "10", 12 | "topic": "/carla/ego_vehicle/speedometer", 13 | "type": "std_msgs/msg/Float32" 14 | }, 15 | { 16 | "fullyQualifiedName": "Vehicle.Airbag.CollisionIntensity", 17 | "interfaceId": "10", 18 | "topic": "/carla/ego_vehicle/collision_intensity", 19 | "type": "std_msgs/msg/Float32" 20 | }, 21 | { 22 | "fullyQualifiedName": "Vehicle.Acceleration", 23 | "interfaceId": "10", 24 | "topic": "/carla/ego_vehicle/imu", 25 | "type": "sensor_msgs/msg/Imu" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /tools/cloud/timestream-to-mdf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | # This script converts Timestream query result data to MDF format. 6 | # To install the required dependencies, follow these instructions: 7 | # 1. For hosts with `apt`: 8 | # 9 | # sudo apt install -y build-essential python3-dev 10 | # 11 | # 2. For hosts with `yum`: 12 | # 13 | # sudo yum groupinstall -y 'Development Tools' 14 | # sudo yum install -y python3-devel 15 | # 16 | # 3. Then install the following Python packages: 17 | # 18 | # pip3 install pandas asammdf 19 | # 20 | 21 | import json 22 | import sys 23 | 24 | import asammdf 25 | import pandas as pd 26 | 27 | if len(sys.argv) < 3: 28 | print("Usage: python3 " + sys.argv[0] + " ") 29 | exit(-1) 30 | 31 | with open(sys.argv[1]) as fp: 32 | data = json.load(fp) 33 | 34 | columns = {} 35 | i = 0 36 | for column in data["ColumnInfo"]: 37 | columns[column["Name"]] = i 38 | i += 1 39 | 40 | 41 | def get_val(row, column): 42 | return ( 43 | None 44 | if "ScalarValue" not in row["Data"][columns[column]] 45 | else row["Data"][columns[column]]["ScalarValue"] 46 | ) 47 | 48 | 49 | df = pd.DataFrame() 50 | for row in data["Rows"]: 51 | ts = get_val(row, "time") 52 | ts = pd.Timestamp(ts).value / 10**9 53 | signal_name = get_val(row, "measure_name") 54 | val = get_val(row, "measure_value::double") 55 | if val is None: 56 | val = get_val(row, "measure_value::bigint") 57 | df.at[ts, signal_name] = float(val) 58 | df.sort_index(inplace=True) 59 | 60 | with asammdf.MDF(version="4.10") as mdf4: 61 | mdf4.append(df) 62 | mdf4.save(sys.argv[2], overwrite=True) 63 | -------------------------------------------------------------------------------- /tools/cloud/vehicle-node.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "branch": { 4 | "fullyQualifiedName": "Vehicle", 5 | "description": "Vehicle" 6 | } 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /tools/code_check/compile_db_remove_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import json 6 | import sys 7 | 8 | # argv[1] should hold the build dir path 9 | cmake_build_dir = sys.argv[1] 10 | 11 | compile_commands = [] 12 | 13 | with open(cmake_build_dir + "/compile_commands.json") as f: 14 | compile_commands = json.load(f) 15 | 16 | output_compile_commands = [] 17 | 18 | for block in compile_commands: 19 | if "command" in block: 20 | # If we keep -Werror, we will get compiler errors from clang that don't happen with GCC. 21 | # Since clang is currently not one of our supported compilers, we will ignore the warnings. 22 | block["command"] = block["command"].replace("-Werror", "") 23 | output_compile_commands.append(block) 24 | 25 | # re-write the db file for clang-tidy 26 | with open(cmake_build_dir + "/Testing/Temporary/compile_commands.json", "w") as f: 27 | f.writelines(json.dumps(output_compile_commands, indent=2)) 28 | -------------------------------------------------------------------------------- /tools/container/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | FROM public.ecr.aws/ubuntu/ubuntu:22.04 AS temp 5 | 6 | # Provided by buildx, e.g.: 'linux/amd64', 'linux/arm64', etc.: 7 | ARG TARGETPLATFORM 8 | 9 | COPY ${TARGETPLATFORM}/aws-iot-fleetwise-edge.tar.gz /tmp/ 10 | COPY ${TARGETPLATFORM}/opt.tar.gz /tmp/ 11 | RUN tar -zxf /tmp/aws-iot-fleetwise-edge.tar.gz -C /usr/bin \ 12 | && tar -zxf /tmp/opt.tar.gz -C / 13 | 14 | FROM public.ecr.aws/ubuntu/ubuntu:22.04 15 | ENV DEBIAN_FRONTEND="noninteractive" 16 | SHELL ["/bin/bash", "-c"] 17 | 18 | ARG DIST_NAME 19 | 20 | RUN apt-get update \ 21 | && apt-get install --no-install-recommends -y \ 22 | ca-certificates \ 23 | iproute2 \ 24 | jq \ 25 | && if [ "${DIST_NAME}" == "aws-iot-fleetwise-edge-ros2" ]; then \ 26 | apt-get install --no-install-recommends -y python3 libspdlog1; \ 27 | fi \ 28 | && rm -rf /var/lib/apt/lists/* 29 | 30 | COPY --from=temp /opt/ /opt/ 31 | COPY --from=temp /usr/bin/aws-iot-fleetwise-edge /usr/bin/ 32 | COPY tools/container/start-fwe.sh /usr/bin/ 33 | COPY tools/configure-fwe.sh /usr/bin/ 34 | COPY LICENSE /usr/share/doc/aws-iot-fleetwise-edge/ 35 | COPY THIRD-PARTY-LICENSES /usr/share/doc/aws-iot-fleetwise-edge/ 36 | COPY configuration/static-config.json /usr/share/aws-iot-fleetwise/ 37 | 38 | ENTRYPOINT ["/usr/bin/start-fwe.sh"] 39 | -------------------------------------------------------------------------------- /tools/container/start-fwe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -euo pipefail 6 | 7 | CONFIG_FILE="/etc/aws-iot-fleetwise/config-0.json" 8 | 9 | mkdir -p `dirname ${CONFIG_FILE}` 10 | /usr/bin/configure-fwe.sh \ 11 | --input-config-file /usr/share/aws-iot-fleetwise/static-config.json \ 12 | --output-config-file ${CONFIG_FILE} \ 13 | $@ 14 | CAN_IF=`jq -r .networkInterfaces[0].canInterface.interfaceName ${CONFIG_FILE}` 15 | PERSISTENCY_PATH=`jq -r .staticConfig.persistency.persistencyPath ${CONFIG_FILE}` 16 | 17 | mkdir -p ${PERSISTENCY_PATH} 18 | 19 | function ifup { 20 | typeset output 21 | output=$(ip link show "$1" up) && [[ -n $output ]] 22 | } 23 | 24 | if [ "${CAN_IF}" != "null" ]; then 25 | while true; do 26 | if ifup ${CAN_IF}; then 27 | break 28 | fi 29 | echo "Waiting for $CAN_IF" 30 | sleep 3 31 | done 32 | fi 33 | 34 | if [ -f /opt/ros/humble/setup.bash ]; then 35 | source /opt/ros/humble/setup.bash 36 | fi 37 | 38 | /usr/bin/aws-iot-fleetwise-edge ${CONFIG_FILE} 39 | -------------------------------------------------------------------------------- /tools/deploy/fwe@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=FWE #%i 3 | After=network-online.target setup-socketcan.service 4 | Wants=network-online.target setup-socketcan.service 5 | 6 | [Service] 7 | Restart=always 8 | RestartSec=1 9 | ExecStart=/usr/bin/run-fwe.sh %i 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /tools/deploy/run-fwe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -e 6 | 7 | if [ $# -eq 0 ]; then 8 | echo "Instance number not provided" 9 | exit 1 10 | fi 11 | 12 | EXTRA_ARGS="" 13 | 14 | if [ -f /opt/ros/humble/setup.sh ]; then 15 | . /opt/ros/humble/setup.sh 16 | EXTRA_ARGS="${EXTRA_ARGS} --ros-args --disable-external-lib-logs" 17 | fi 18 | 19 | export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp 20 | /usr/bin/aws-iot-fleetwise-edge /etc/aws-iot-fleetwise/config-$1.json ${EXTRA_ARGS} 21 | -------------------------------------------------------------------------------- /tools/deploy/start-and-enable-fwe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -e 6 | 7 | # Start and enable the FWE service at startup: 8 | systemctl daemon-reload 9 | FLEET_SIZE=`ls -1 /etc/aws-iot-fleetwise/*.json | wc -l` 10 | LAST_SERVICE=0 # expr returns error code when the expression result is 0, so default to 0 11 | if [ "${FLEET_SIZE}" != "1" ]; then 12 | LAST_SERVICE=`expr ${FLEET_SIZE} - 1` 13 | fi 14 | SERVICES="" 15 | for i in `seq 0 ${LAST_SERVICE}`; do 16 | SERVICES="${SERVICES} fwe@$i" 17 | done 18 | echo "Starting and enabling${SERVICES}" 19 | systemctl enable ${SERVICES} 20 | START_TIME=$(date -u '+%Y-%m-%d %H:%M:%S') 21 | systemctl start ${SERVICES} 22 | 23 | SUCCESS_MESSAGE="Started successfully" 24 | for SERVICE_NAME in ${SERVICES}; do 25 | # sed will quit as soon as it finds the first match and this will make `journalctl -f` quit too 26 | if timeout 5s bash -c "journalctl -u ${SERVICE_NAME} -f --no-tail --since \"${START_TIME}\" | sed '/${SUCCESS_MESSAGE}/ q' > /dev/null"; then 27 | echo "${SERVICE_NAME} started successfully" 28 | else 29 | echo "${SERVICE_NAME} didn't start correctly. Please check the logs below:" 30 | journalctl -u ${SERVICE_NAME} --since "${START_TIME}" 31 | exit 1 32 | fi 33 | done 34 | -------------------------------------------------------------------------------- /tools/deploy/stop-fwe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FLEET_SIZE=`ls -1 /etc/aws-iot-fleetwise/*.json | wc -l` 6 | LAST_SERVICE=`expr ${FLEET_SIZE} - 1` 7 | SERVICES="" 8 | for i in `seq 0 ${LAST_SERVICE}`; do 9 | SERVICES="${SERVICES} fwe@$i" 10 | done 11 | echo "Stopping${SERVICES}" 12 | systemctl stop ${SERVICES} 2> /dev/null || true 13 | -------------------------------------------------------------------------------- /tools/greengrassV2/.gitignore: -------------------------------------------------------------------------------- 1 | artifacts/ 2 | -------------------------------------------------------------------------------- /tools/greengrassV2/recipes/com.amazon.aws.IoTFleetWise-1.0.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "RecipeFormatVersion": "2020-01-25", 3 | "ComponentName": "com.amazon.aws.IoTFleetWise", 4 | "ComponentVersion": "1.0.0", 5 | "ComponentDescription": "Reference Implementation for AWS IoT FleetWise", 6 | "ComponentPublisher": "Amazon", 7 | "ComponentConfiguration": { 8 | "DefaultConfiguration": { 9 | "Message": "world", 10 | "accessControl": { 11 | "aws.greengrass.ipc.mqttproxy": { 12 | "com.amazon.aws.IoTFleetWise:mqttproxy:1": { 13 | "policyDescription": "Allows access to publish/subscribe to all topics.", 14 | "operations": ["aws.greengrass#PublishToIoTCore", "aws.greengrass#SubscribeToIoTCore"], 15 | "resources": ["*"] 16 | } 17 | } 18 | } 19 | } 20 | }, 21 | "Manifests": [ 22 | { 23 | "Platform": { 24 | "os": "linux" 25 | }, 26 | "Lifecycle": { 27 | "Run": "{artifacts:path}/aws-iot-fleetwise-edge {artifacts:path}/config-0.json", 28 | "SetEnv": { 29 | "RMW_IMPLEMENTATION": "rmw_cyclonedds_cpp" 30 | } 31 | } 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /tools/greengrassV2/recipes/com.amazon.aws.IoTFleetWise-2.0.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "RecipeFormatVersion": "2020-01-25", 3 | "ComponentName": "com.amazon.aws.IoTFleetWise", 4 | "ComponentVersion": "2.0.0", 5 | "ComponentDescription": "Reference Implementation for AWS IoT FleetWise", 6 | "ComponentPublisher": "Amazon", 7 | "ComponentConfiguration": { 8 | "DefaultConfiguration": { 9 | "Message": "world", 10 | "accessControl": { 11 | "aws.greengrass.ipc.mqttproxy": { 12 | "com.amazon.aws.IoTFleetWise:mqttproxy:1": { 13 | "policyDescription": "Allows access to publish/subscribe to all topics.", 14 | "operations": ["aws.greengrass#PublishToIoTCore", "aws.greengrass#SubscribeToIoTCore"], 15 | "resources": ["*"] 16 | } 17 | } 18 | } 19 | } 20 | }, 21 | "Manifests": [ 22 | { 23 | "Platform": { 24 | "os": "linux" 25 | }, 26 | "Lifecycle": { 27 | "Run": "{artifacts:path}/aws-iot-fleetwise-edge {artifacts:path}/config-0.json", 28 | "SetEnv": { 29 | "RMW_IMPLEMENTATION": "rmw_cyclonedds_cpp" 30 | }, 31 | "RequiresPrivilege": "true" 32 | }, 33 | "Artifacts": [ 34 | { 35 | "Uri": "s3://URI-TO-FWE-BINARY/com.amazon.aws.IoTFleetWise/2.0.0/aws-iot-fleetwise-edge", 36 | "Permission": { 37 | "Read": "ALL", 38 | "Execute": "ALL" 39 | } 40 | }, 41 | { 42 | "Uri": "s3://URI-TO-FWE-STATIC-CONFIG/com.amazon.aws.IoTFleetWise/2.0.0/config-0.json", 43 | "Permission": { 44 | "Read": "ALL", 45 | "Execute": "ALL" 46 | } 47 | } 48 | ] 49 | } 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /tools/install-deps-versions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | 4 | export VERSION_BOOST="1.84.0" 5 | # This should be a commit from https://github.com/moritz-wundke/Boost-for-Android that provides 6 | # support for the desired boost version. 7 | export VERSION_BOOST_FOR_ANDROID="83ba7174dea6e0595085dc30051eb17747e7260a" 8 | export VERSION_JSON_CPP="1.9.5" 9 | export VERSION_PROTOBUF="3.21.12" 10 | export VERSION_PROTOBUF_RELEASE="v21.12" 11 | export VERSION_CURL="7.86.0" 12 | export VERSION_CURL_RELEASE="curl-7_86_0" 13 | export VERSION_AWS_SDK_CPP="1.11.284" 14 | # MAKE SURE THE CRT VERSION IN AWS_SDK_CPP IS THE SAME AS IN AWS_IOT_SDK_CPP 15 | export VERSION_AWS_IOT_DEVICE_SDK_CPP_V2="v1.32.2" 16 | export VERSION_FAKETIME="v0.9.10" 17 | export VERSION_TINYXML2="6.0.0" 18 | export VERSION_FAST_CDR="v1.0.24" 19 | export VERSION_GOOGLE_TEST="v1.15.2" 20 | export VERSION_GOOGLE_BENCHMARK="v1.6.1" 21 | export VERSION_ANDROID_CMDLINE_TOOLS="9123335" 22 | export VERSION_ANDROID_NDK="23.1.7779620" 23 | export VERSION_ANDROID_API="21" 24 | export VERSION_ANDROID_SDK="33" 25 | export VERSION_ANDROID_BUILD_TOOLS="30.0.3" 26 | export VERSION_CMAKE="3.22.1" # Provided by Ubuntu 22.04, version here used for Android build 27 | export VERSION_SNAPPY="1.1.8" # Provided by Ubuntu 22.04, version here used for Android build 28 | export VERSION_OPENSSL="3.0.2" # Provided by Ubuntu 22.04, version here used for Android build 29 | export VERSION_ION_C="v1.1.2" 30 | export VERSION_VSOMEIP="3.5.1" 31 | export VERSION_COMMON_API="3.2.4" 32 | export VERSION_COMMON_API_SOMEIP="3.2.4" 33 | export VERSION_COMMON_API_GENERATOR="3.2.15" 34 | export VERSION_PYBIND11="v2.10.0" 35 | export VERSION_DEVICE_STORELIBRARY_CPP="1.0.0" 36 | export VERSION_MICROPYTHON="v1.23.0" 37 | -------------------------------------------------------------------------------- /tools/install-deps-yocto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -euo pipefail 6 | 7 | export DEBIAN_FRONTEND="noninteractive" 8 | 9 | apt-get update 10 | apt-get install -y \ 11 | gawk wget git-core diffstat unzip texinfo \ 12 | build-essential chrpath socat cpio python3 python3-pip python3-pexpect \ 13 | xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \ 14 | pylint xterm curl dosfstools mtools parted syslinux-common tree zip ca-certificates \ 15 | zstd lz4 file 16 | 17 | if [ `dpkg --print-architecture` == "amd64" ]; then 18 | apt-get install -y gcc-multilib 19 | fi 20 | 21 | # Google 'repo' tool, see https://source.android.com/setup/develop/repo 22 | curl https://raw.githubusercontent.com/GerritCodeReview/git-repo/v2.36.1/repo > /usr/local/bin/repo 23 | chmod +x /usr/local/bin/repo 24 | -------------------------------------------------------------------------------- /tools/install-fwe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -e 6 | 7 | ./tools/deploy/stop-fwe.sh 8 | 9 | mkdir -p /var/aws-iot-fleetwise 10 | 11 | cp build/aws-iot-fleetwise-edge /usr/bin/ 12 | cp tools/deploy/run-fwe.sh /usr/bin/ 13 | cp tools/deploy/fwe@.service /lib/systemd/system/ 14 | 15 | ./tools/deploy/start-and-enable-fwe.sh 16 | -------------------------------------------------------------------------------- /tools/install-rossim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -eo pipefail 6 | 7 | # Install ROS2 Simulator 8 | cp -r tools/rossim /usr/share 9 | cp tools/rossim/rossim.service /lib/systemd/system/ 10 | 11 | # Download Rosbag 12 | aws s3 cp s3://aws-iot-fleetwise/rosbag2_vision_system_data_demo.db3 /usr/share/rossim 13 | 14 | systemctl daemon-reload 15 | systemctl enable rossim 16 | systemctl start rossim 17 | 18 | # Check that the simulator started correctly and is generating data 19 | source /opt/ros/humble/setup.bash 20 | if ! timeout 5s bash -c "while ! ros2 topic list | grep -q -v -E '(/parameter_events|/rosout)'; do sleep 1; done"; then 21 | echo "No ROS2 messages are being sent by the simuator" 22 | exit 1 23 | fi 24 | -------------------------------------------------------------------------------- /tools/patches/capicxx_core_runtime_allow_static_libs.patch: -------------------------------------------------------------------------------- 1 | From b0194fa7bf389c9fb93224c7848347e95df53ca5 Mon Sep 17 00:00:00 2001 2 | From: Geoff Phillips 3 | Date: Wed, 27 Sep 2023 18:20:24 +0200 4 | Subject: [PATCH] Allow static libs 5 | 6 | - Remove SHARED option from add_library to allow static libs, 7 | CMake then respects the standard BUILD_SHARED_LIBS option. 8 | --- 9 | CMakeLists.txt | 2 +- 10 | 1 file changed, 1 insertion(+), 1 deletion(-) 11 | 12 | diff --git a/CMakeLists.txt b/CMakeLists.txt 13 | index 11eb544..8c67377 100644 14 | --- a/CMakeLists.txt 15 | +++ b/CMakeLists.txt 16 | @@ -131,7 +131,7 @@ link_directories( 17 | 18 | file(GLOB CAPI_SRCS "src/CommonAPI/*.cpp") 19 | list(SORT CAPI_SRCS) 20 | -add_library(CommonAPI SHARED ${CAPI_SRCS}) 21 | +add_library(CommonAPI ${CAPI_SRCS}) 22 | target_link_libraries(CommonAPI PRIVATE ${DL_LIBRARY} ${DLT_LIBRARIES}) 23 | set_target_properties(CommonAPI PROPERTIES VERSION ${LIBCOMMONAPI_MAJOR_VERSION}.${LIBCOMMONAPI_MINOR_VERSION}.${LIBCOMMONAPI_PATCH_VERSION} SOVERSION ${LIBCOMMONAPI_MAJOR_VERSION}.${LIBCOMMONAPI_MINOR_VERSION}.${LIBCOMMONAPI_PATCH_VERSION} LINKER_LANGUAGE C) 24 | target_include_directories(CommonAPI INTERFACE 25 | -- 26 | 2.25.1 27 | -------------------------------------------------------------------------------- /tools/requirements-unit-test.txt: -------------------------------------------------------------------------------- 1 | pytest==8.3.2 2 | pytest-cpp==2.6.0 3 | pytest-html==4.1.1 4 | ansi2html==1.9.2 5 | pytest-metadata==3.1.1 6 | pytest-random-order==1.1.1 7 | pytest-xdist==3.6.1 8 | -------------------------------------------------------------------------------- /tools/rossim/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "topics": [ 3 | { 4 | "name": "ImageTopic", 5 | "module": "sensor_msgs.msg", 6 | "type": "Image", 7 | "period_sec": 1 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /tools/rossim/rossim.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ROS2 Simulator 3 | 4 | [Service] 5 | Restart=always 6 | RestartSec=1 7 | ExecStart=/bin/bash -c "HOME=/root /usr/share/rossim/run-rossim.sh" 8 | WorkingDirectory=/usr/share/rossim 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /tools/rossim/run-rossim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -eo pipefail 6 | 7 | source /opt/ros/humble/setup.bash 8 | ros2 bag play --loop rosbag2_vision_system_data_demo.db3 9 | -------------------------------------------------------------------------------- /tools/rossim/vals_default.json: -------------------------------------------------------------------------------- 1 | { 2 | "ImageTopic": { 3 | "data": [], 4 | "encoding": "", 5 | "header": { 6 | "frame_id": "", 7 | "stamp": { 8 | "nanosec": 0, 9 | "sec": 0 10 | } 11 | }, 12 | "height": 0, 13 | "is_bigendian": 0, 14 | "step": 0, 15 | "width": 0 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tools/setup-yocto-s32g.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -eo pipefail 6 | 7 | # 'repo' requires that Git is configured, otherwise it interactively prompts for the configuration: 8 | git config user.name > /dev/null || git config --global user.name "ubuntu" 9 | git config user.email > /dev/null || git config --global user.email "ubuntu@`hostname`" 10 | git config color.ui || git config --global color.ui false 11 | 12 | python3 $(which repo) init -b release/bsp38.0 -u https://github.com/nxp-auto-linux/auto_yocto_bsp.git 13 | python3 $(which repo) sync 14 | 15 | SCRIPTPATH=`dirname $0` 16 | cp -r ${SCRIPTPATH}/yocto/* . 17 | -------------------------------------------------------------------------------- /tools/someip_device_shadow_editor/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | someip_device_shadow_editor.so 3 | vsomeip-log.txt 4 | commonapi-log.txt 5 | mylog.log 6 | -------------------------------------------------------------------------------- /tools/someip_device_shadow_editor/README.md: -------------------------------------------------------------------------------- 1 | # Someip device shadow editor 2 | 3 | This module is simulating device shadow requests (get/update etc.) 4 | 5 | #### Using the REPL 6 | 7 | The `someip_device_shadow_editor_repl.py` script provides a REPL for interactive device shadow 8 | update. To use it, simply run the script from the command line: 9 | 10 | ```bash 11 | VSOMEIP_CONFIGURATION=vsomeip-config.json COMMONAPI_CONFIG=commonapi-config.ini python3 someipigen_repl_device_shadow.py 12 | ``` 13 | 14 | Type `help` to get familiarity with command usage. 15 | 16 | You can use the following commands: 17 | 18 | - `get `: Get shadow document 19 | - `update `: Update shadow document 20 | - `delete `: Deletes a shadow 21 | - `help`: Display the list of available commands. 22 | - `exit` or `quit`: Exit the REPL. 23 | 24 | Note: `` can be a blank string to set the 'classic' shadow. 25 | 26 | Example: 27 | 28 | ```bash 29 | update test {"state":{"desired":{"temperature":25},"reported":{"temperature":22}}} 30 | get test 31 | delete test 32 | ``` 33 | 34 | This interactive environment is useful for testing device shadow on the fly. 35 | -------------------------------------------------------------------------------- /tools/someip_device_shadow_editor/commonapi-config.ini: -------------------------------------------------------------------------------- 1 | [default] 2 | binding=someip 3 | 4 | [logging] 5 | console=false 6 | file=commonapi-log.txt 7 | dlt=false 8 | level=trace 9 | -------------------------------------------------------------------------------- /tools/someip_device_shadow_editor/linker.lds: -------------------------------------------------------------------------------- 1 | { 2 | global: PyInit_someip_device_shadow_editor; 3 | local: *; 4 | }; 5 | -------------------------------------------------------------------------------- /tools/someip_device_shadow_editor/src/bindings.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "DeviceShadowOverSomeipExampleApplication.hpp" 5 | #include // IWYU pragma: keep 6 | #include 7 | #include // IWYU pragma: keep 8 | #include // IWYU pragma: keep 9 | #include // IWYU pragma: keep 10 | 11 | namespace py = pybind11; 12 | 13 | PYBIND11_MODULE( someip_device_shadow_editor, m ) 14 | { 15 | py::class_( m, "DeviceShadowOverSomeipExampleApplication" ) 16 | .def( py::init<>() ) 17 | .def( "init", &DeviceShadowOverSomeipExampleApplication::init ) 18 | .def( "deinit", &DeviceShadowOverSomeipExampleApplication::deinit ) 19 | .def( "get_shadow", &DeviceShadowOverSomeipExampleApplication::getShadow ) 20 | .def( "update_shadow", &DeviceShadowOverSomeipExampleApplication::updateShadow ) 21 | .def( "delete_shadow", &DeviceShadowOverSomeipExampleApplication::deleteShadow ) 22 | .def( "get_instance", &DeviceShadowOverSomeipExampleApplication::getInstance ); 23 | } 24 | -------------------------------------------------------------------------------- /tools/someip_device_shadow_editor/vsomeip-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "logging": { 3 | "level": "trace", 4 | "console": "false", 5 | "file": { 6 | "enable": "true", 7 | "path": "vsomeip-log.txt" 8 | }, 9 | "dlt": "false", 10 | "version": { 11 | "enable": "false" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tools/someipigen/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | someipigen.so 3 | vsomeip-log.txt 4 | commonapi-log.txt 5 | mylog.log 6 | vsomeip-someipigen.json 7 | -------------------------------------------------------------------------------- /tools/someipigen/commonapi-config.ini: -------------------------------------------------------------------------------- 1 | [default] 2 | binding=someip 3 | 4 | [logging] 5 | console=false 6 | file=commonapi-log.txt 7 | dlt=false 8 | level=trace 9 | -------------------------------------------------------------------------------- /tools/someipigen/linker.lds: -------------------------------------------------------------------------------- 1 | { 2 | global: PyInit_someipigen; 3 | local: *; 4 | }; 5 | -------------------------------------------------------------------------------- /tools/someipigen/signals.json: -------------------------------------------------------------------------------- 1 | { 2 | "Int32": 10, 3 | "Int64": 1000, 4 | "Boolean": false, 5 | "Float": 1.23, 6 | "Double": 1.234567, 7 | "Vehicle.ExampleSomeipInterface.A1.A2.A": 100, 8 | "Vehicle.ExampleSomeipInterface.A1.A2.B": false, 9 | "Vehicle.ExampleSomeipInterface.A1.A2.D": 1.0, 10 | "Vehicle.ExampleSomeipInterface.A1.S": "hi", 11 | "Vehicle.ExampleSomeipInterface.X": 1, 12 | "Vehicle.ExampleSomeipInterface.Temperature": 1 13 | } 14 | -------------------------------------------------------------------------------- /tools/someipigen/someipigen.cmake: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | pybind11_add_module(someipigen 4 | tools/someipigen/src/SignalManager.cpp 5 | tools/someipigen/src/bindings.cpp 6 | tools/someipigen/src/ExampleSomeipInterfaceStubImpl.cpp 7 | $ 8 | ) 9 | 10 | target_include_directories(someipigen PUBLIC 11 | ${JSONCPP_INCLUDE_DIR} 12 | ${Python3_INCLUDE_DIRS} 13 | ${VSOMEIP_INCLUDE_DIR} 14 | ${COMMONAPI_INCLUDE_DIRS} 15 | ${COMMONAPI_SOMEIP_INCLUDE_DIRS} 16 | $ 17 | ) 18 | 19 | target_link_libraries(someipigen PRIVATE 20 | ${JSONCPP_LIBRARY} 21 | CommonAPI-SomeIP 22 | CommonAPI 23 | ${VSOMEIP_LIBRARIES} 24 | Boost::thread 25 | Boost::filesystem 26 | Boost::system 27 | # Workaround for GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68479 28 | # Only export the PyInit_ symbol, otherwise if the .so is statically linked with 29 | # -static-libstdc++, then std::stringstream breaks when multiple shared libraries are imported. 30 | -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/tools/someipigen/linker.lds 31 | ) 32 | 33 | # This will create someipigen.so without the 'lib' prefix 34 | set_target_properties(someipigen PROPERTIES 35 | PREFIX "" 36 | OUTPUT_NAME "someipigen" 37 | SUFFIX ".so" 38 | ) 39 | 40 | # Disabling -Werror specifically for this target due to an issue: 41 | # https://github.com/pybind/pybind11/issues/1917 42 | target_compile_options(someipigen PRIVATE 43 | -Wno-error 44 | ) 45 | 46 | install(TARGETS someipigen 47 | LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR} 48 | ) 49 | -------------------------------------------------------------------------------- /tools/someipigen/someipsim.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import datetime 6 | import time 7 | 8 | import someipigen 9 | 10 | domain = "local" 11 | instance = "commonapi.ExampleSomeipInterface" 12 | connection = "someipigen" 13 | someip_sim = someipigen.SignalManager() 14 | someip_sim.start(domain, instance, connection) 15 | 16 | X_SIGNAL = "Vehicle.ExampleSomeipInterface.X" 17 | A_SIGNAL = "Vehicle.ExampleSomeipInterface.A1.A2.A" 18 | B_SIGNAL = "Vehicle.ExampleSomeipInterface.A1.A2.B" 19 | D_SIGNAL = "Vehicle.ExampleSomeipInterface.A1.A2.D" 20 | 21 | 22 | def set_with_print(func, name, val): 23 | print(str(datetime.datetime.now()) + " Set " + name + " to " + str(val)) 24 | func(name, val) 25 | 26 | 27 | try: 28 | while True: 29 | set_with_print(someip_sim.set_value, X_SIGNAL, 0) 30 | for i in range(1, 11): 31 | set_with_print(someip_sim.set_value, B_SIGNAL, i & 1 != 0) 32 | set_with_print(someip_sim.set_value, D_SIGNAL, i * 3.142) 33 | time.sleep(5) 34 | set_with_print(someip_sim.set_value, A_SIGNAL, i * 100) 35 | time.sleep(0.5) 36 | set_with_print(someip_sim.set_value, X_SIGNAL, i * 200) 37 | except KeyboardInterrupt: 38 | print("Stopping...") 39 | someip_sim.stop() 40 | -------------------------------------------------------------------------------- /tools/someipigen/vsomeip-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "logging": { 3 | "level": "trace", 4 | "console": "false", 5 | "file": { 6 | "enable": "true", 7 | "path": "vsomeip-log.txt" 8 | }, 9 | "dlt": "false", 10 | "version": { 11 | "enable": "false" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tools/test-fwe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | set -efo pipefail 6 | 7 | WITH_ROS2_SUPPORT="false" 8 | 9 | parse_args() { 10 | while [ "$#" -gt 0 ]; do 11 | case $1 in 12 | --with-ros2-support) 13 | WITH_ROS2_SUPPORT="true" 14 | ;; 15 | --help) 16 | echo "Usage: $0 [OPTION]" 17 | echo " --with-ros2-support Test with ROS2 support" 18 | exit 0 19 | ;; 20 | esac 21 | shift 22 | done 23 | } 24 | 25 | parse_args "$@" 26 | 27 | if ${WITH_ROS2_SUPPORT}; then 28 | source /opt/ros/humble/setup.bash 29 | cd build/iotfleetwise 30 | else 31 | cd build 32 | fi 33 | ctest -V 34 | -------------------------------------------------------------------------------- /tools/yocto/.gitignore: -------------------------------------------------------------------------------- 1 | !build*/ 2 | -------------------------------------------------------------------------------- /tools/yocto/README.md: -------------------------------------------------------------------------------- 1 | # Yocto Reference Project for AWS IoTFleetWise 2 | 3 | The project is based on NXP Linux BSP 38.0 for the S32G-VNP-RDB2 board which can be downloaded from: 4 | https://github.com/nxp-auto-linux/auto_yocto_bsp 5 | 6 | This folder provides an additional meta layer on top of BSP 38.0, in order to add the following: 7 | 8 | - `linux-s32` - Adds the CAN ISO-TP kernel module 9 | - `setup-socketcan` - Adds a `systemd` service to bring up SocketCAN interfaces at startup 10 | 11 | ## Prerequisites 12 | 13 | Run the following script to install the prerequisites on an Ubuntu 22.04 host machine (assuming you 14 | have cloned this repo in `~/aws-iot-fleetwise-edge`): 15 | 16 | sudo ~/aws-iot-fleetwise-edge/tools/install-deps-yocto.sh 17 | 18 | ## Setup Yocto Project 19 | 20 | Run the following script to clone the NXP Linux BSP 38.0 Yocto project for the S32G and add the 21 | `meta-aws-iot-fleetwise` layer: 22 | 23 | mkdir -p ~/yocto-build && cd ~/yocto-build 24 | ~/aws-iot-fleetwise-edge/tools/setup-yocto-s32g.sh 25 | 26 | ## Build SD-Card Image 27 | 28 | Then run `bitbake` as follows to build the Yocto project and create the SD-card image: 29 | 30 | source sources/poky/oe-init-build-env build_s32g274ardb2ubuntu 31 | bitbake fsl-image-ubuntu 32 | 33 | The resulting SD card image can then be found here: 34 | `build_s32g274ardb2ubuntu/tmp/deploy/images/s32g274ardb2/fsl-image-ubuntu-s32g274ardb2.sdcard` 35 | -------------------------------------------------------------------------------- /tools/yocto/build_s32g274ardb2ubuntu/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | # POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf 2 | # changes incompatibly 3 | POKY_BBLAYERS_CONF_VERSION = "2" 4 | 5 | BBPATH = "${TOPDIR}" 6 | BBFILES ?= "" 7 | 8 | BBLAYERS ?= " \ 9 | ${TOPDIR}/../sources/poky/meta \ 10 | ${TOPDIR}/../sources/poky/meta-poky \ 11 | ${TOPDIR}/../sources/poky/meta-yocto-bsp \ 12 | ${TOPDIR}/../sources/meta-openembedded/meta-oe \ 13 | ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \ 14 | ${TOPDIR}/../sources/meta-openembedded/meta-python \ 15 | ${TOPDIR}/../sources/meta-openembedded/meta-python2 \ 16 | ${TOPDIR}/../sources/meta-openembedded/meta-networking \ 17 | ${TOPDIR}/../sources/meta-openembedded/meta-gnome \ 18 | ${TOPDIR}/../sources/meta-openembedded/meta-filesystems \ 19 | ${TOPDIR}/../sources/meta-openembedded/meta-webserver \ 20 | ${TOPDIR}/../sources/meta-openembedded/meta-perl \ 21 | ${TOPDIR}/../sources/meta-openembedded/meta-xfce \ 22 | ${TOPDIR}/../sources/meta-virtualization \ 23 | ${TOPDIR}/../sources/meta-freescale \ 24 | ${TOPDIR}/../sources/meta-alb \ 25 | ${TOPDIR}/../sources/meta-aws-iot-fleetwise \ 26 | " 27 | -------------------------------------------------------------------------------- /tools/yocto/build_s32g274ardb2ubuntu/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 's32g274ardb2ubuntu' 2 | DISTRO ?= 'fsl-auto' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS ??= "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | HALT,${TMPDIR},100M,1K \ 13 | HALT,${DL_DIR},100M,1K \ 14 | HALT,${SSTATE_DIR},100M,1K \ 15 | HALT,/tmp,10M,1K" 16 | PACKAGECONFIG:append_pn-qemu-system-native = " sdl" 17 | CONF_VERSION = "2" 18 | 19 | # Parallelism Options 20 | BB_NUMBER_THREADS = "${@oe.utils.cpu_count()}" 21 | PARALLEL_MAKE = "-j ${@oe.utils.cpu_count()}" 22 | DL_DIR ?= "${TOPDIR}/../downloads" 23 | SSTATE_DIR ?= "${TOPDIR}/../sstate-cache-ubuntu" 24 | INHERIT += "own-mirrors" 25 | SOURCE_MIRROR_URL ?= "http://git.freescale.com/source/" 26 | SSTATE_MIRRORS ?= "file://.*/(.*)/(.*) file://${SSTATE_DIR}/native/\1/\2 \n" 27 | # use xz to compress sstate 28 | SSTATE_PKG_SUFFIX = "txz" 29 | SSTATE_PKG_TARZIPPROG = "xz" 30 | 31 | # Ubuntu Version 32 | UBUNTU_TARGET_VERSION = "22.04.1" 33 | 34 | # Additional recipes 35 | IMAGE_INSTALL:append = " \ 36 | can-utils \ 37 | can-utils-access \ 38 | can-utils-cantest \ 39 | can-utils-isotp \ 40 | can-utils-j1939 \ 41 | can-utils-log \ 42 | can-utils-slcan \ 43 | setup-socketcan \ 44 | " 45 | 46 | PREFERRED_RPROVIDER_python3 = "ubuntu-base" 47 | PREFERRED_RPROVIDER_python3-core = "ubuntu-base" 48 | -------------------------------------------------------------------------------- /tools/yocto/sources/meta-aws-iot-fleetwise/conf/layer.conf: -------------------------------------------------------------------------------- 1 | # We have a conf and classes directory, add to BBPATH 2 | BBPATH .= ":${LAYERDIR}" 3 | 4 | # We have recipes-* directories, add to BBFILES 5 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ 6 | ${LAYERDIR}/recipes-*/*/*.bbappend" 7 | 8 | BBFILE_COLLECTIONS += "meta-aws-iot-fleetwise" 9 | BBFILE_PATTERN_meta-aws-iot-fleetwise = "^${LAYERDIR}/" 10 | BBFILE_PRIORITY_meta-aws-iot-fleetwise = "7" 11 | 12 | LAYERSERIES_COMPAT_meta-aws-iot-fleetwise = "kirkstone" 13 | -------------------------------------------------------------------------------- /tools/yocto/sources/meta-aws-iot-fleetwise/recipes-extended/setup-socketcan/files/setup-socketcan.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Setup SocketCAN interfaces 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | RemainAfterExit=yes 8 | ExecStart=/bin/sh /usr/bin/setup-socketcan.sh 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /tools/yocto/sources/meta-aws-iot-fleetwise/recipes-extended/setup-socketcan/files/setup-socketcan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | 4 | ip link add dev vcan0 type vcan; ip link set up vcan0 5 | ip link add dev vcan1 type vcan; ip link set up vcan1 6 | ip link set up can0 txqueuelen 1000 type can bitrate 500000 dbitrate 5000000 fd on restart-ms 100 7 | ip link set up can1 txqueuelen 1000 type can bitrate 500000 dbitrate 5000000 fd on restart-ms 100 8 | -------------------------------------------------------------------------------- /tools/yocto/sources/meta-aws-iot-fleetwise/recipes-extended/setup-socketcan/setup-socketcan.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Setup SocketCAN at Startup" 2 | LICENSE = "CLOSED" 3 | 4 | SRC_URI = "file://setup-socketcan.sh \ 5 | file://setup-socketcan.service" 6 | 7 | S = "${WORKDIR}" 8 | 9 | SYSTEMD_SERVICE:${PN} = "${PN}.service" 10 | 11 | FILES:${PN} += "${systemd_system_unitdir} ${bindir}" 12 | 13 | inherit systemd 14 | 15 | do_install() { 16 | install -d ${D}${systemd_system_unitdir} 17 | install -m 0755 ${S}/setup-socketcan.service ${D}${systemd_system_unitdir} 18 | install -d ${D}${bindir} 19 | install -m 0755 ${S}/setup-socketcan.sh ${D}${bindir} 20 | } 21 | -------------------------------------------------------------------------------- /tools/yocto/sources/meta-aws-iot-fleetwise/recipes-kernel/linux-s32/files/can-isotp.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_CAN_ISOTP=y 2 | -------------------------------------------------------------------------------- /tools/yocto/sources/meta-aws-iot-fleetwise/recipes-kernel/linux-s32/linux-s32_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/files:" 2 | 3 | inherit kernel 4 | 5 | SRC_URI += " \ 6 | file://can-isotp.cfg" 7 | 8 | DELTA_KERNEL_DEFCONFIG:append = "can-isotp.cfg" 9 | --------------------------------------------------------------------------------