Loading automotive/ivn_android_device/impl/default/Android.bp 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package { default_applicable_licenses: ["Android-Apache-2.0"], } cc_library { name: "IvnAndroidDeviceService", vendor_available: true, local_include_dirs: ["include"], export_include_dirs: ["include"], srcs: [ "src/IvnAndroidDeviceService.cpp", ], whole_static_libs: [ "android.hardware.automotive.ivn-V1-ndk", ], shared_libs: [ "libbase", "libbinder_ndk", "libjsoncpp", "liblog", "libutils", ], } cc_binary { name: "android.hardware.automotive.ivn@V1-default-service", vendor: true, relative_install_path: "hw", local_include_dirs: ["include"], srcs: ["src/IvnAndroidDeviceImpl.cpp"], whole_static_libs: ["IvnAndroidDeviceService"], shared_libs: [ "libbase", "libbinder_ndk", "libjsoncpp", "liblog", "libutils", ], required: ["Prebuilt_IvnAndroidDeviceServiceDefaultConfig_JSON"], vintf_fragments: ["ivn-default-service.xml"], init_rc: ["ivn-default-service.rc"], } automotive/ivn_android_device/impl/default/config/Android.bp 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package { default_applicable_licenses: ["Android-Apache-2.0"], } filegroup { name: "IvnAndroidDeviceServiceDefaultConfig_Json", srcs: ["DefaultConfig.json"], } prebuilt_etc { name: "Prebuilt_IvnAndroidDeviceServiceDefaultConfig_JSON", filename_from_src: true, src: "DefaultConfig.json", sub_dir: "automotive/IvnConfig/", vendor: true, } automotive/ivn_android_device/impl/default/config/DefaultConfig.json 0 → 100644 +61 −0 Original line number Diff line number Diff line { "MyDeviceId": 0, "Devices": [ { "DeviceId": 0, "OccupantZones": [ { "ZoneId": 0, "OccupantType": "DRIVER", "Seat": 1, "Comments": "Occupant zone for driver and FRONT_LEFT seat" }, { "ZoneId": 1, "OccupantType": "FRONT_PASSENGER", "Seat": 4, "Comments": "Occupant zone for FRONT_RIGHT passenger" } ], "EndpointInfo": { "IpAddress": "10.10.10.1", "PortNumber": 1234, "BrandName": "MyBrand", "DeviceName": "MyDevice", "ProductName": "MyProduct", "ManufacturerName": "MyCompany", "ModelName": "MyModel", "SerialNumber": "Serial1234" }, "Comments": "Device for front row" }, { "DeviceId": 1, "OccupantZones": [ { "ZoneId": 2, "OccupantType": "REAR_PASSENGER", "Seat": 16 }, { "ZoneId": 3, "OccupantType": "REAR_PASSENGER", "Seat": 64 } ], "EndpointInfo": { "IpAddress": "10.10.10.2", "PortNumber": 2345, "BrandName": "MyBrand", "DeviceName": "MyDevice", "ProductName": "MyProduct", "ManufacturerName": "MyCompany", "ModelName": "MyModel", "SerialNumber": "Serial2345" }, "Comments": "Device for back row" } ], "Comment": "This simulates a vehicle with two Android devices, one for front row, one for back row" } automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h 0 → 100644 +72 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <aidl/android/hardware/automotive/ivn/BnIvnAndroidDevice.h> #include <aidl/android/hardware/automotive/ivn/EndpointInfo.h> #include <aidl/android/hardware/automotive/ivn/OccupantZoneInfo.h> #include <android/binder_auto_utils.h> #include <vector> #include <unordered_map> namespace android { namespace hardware { namespace automotive { namespace ivn { struct DeviceInfo { std::vector<aidl::android::hardware::automotive::ivn::OccupantZoneInfo> occupantZones; aidl::android::hardware::automotive::ivn::EndpointInfo endpointInfo; }; class IvnAndroidDeviceService : public aidl::android::hardware::automotive::ivn::BnIvnAndroidDevice { public: explicit IvnAndroidDeviceService(std::string_view configPath); // Initialize the service, returns true on success. bool init(); ndk::ScopedAStatus getMyDeviceId(int* deviceId) override; ndk::ScopedAStatus getOtherDeviceIds(std::vector<int>* deviceIds) override; ndk::ScopedAStatus getDeviceIdForOccupantZone(int zoneId, int* deviceId) override; ndk::ScopedAStatus getOccupantZonesForDevice( int androidDeviceId, std::vector<aidl::android::hardware::automotive::ivn::OccupantZoneInfo>* occupantZones) override; ndk::ScopedAStatus getMyEndpointInfo( aidl::android::hardware::automotive::ivn::EndpointInfo* endpointInfo) override; ndk::ScopedAStatus getEndpointInfoForDevice( int androidDeviceId, aidl::android::hardware::automotive::ivn::EndpointInfo* endpointInfo) override; private: int mMyDeviceId; std::unordered_map<int, DeviceInfo> mDeviceInfoById; std::string_view mConfigPath; }; } // namespace ivn } // namespace automotive } // namespace hardware } // namespace android automotive/ivn_android_device/impl/default/ivn-default-service.rc 0 → 100644 +4 −0 Original line number Diff line number Diff line service vendor.ivn-default /vendor/bin/hw/android.hardware.automotive.ivn@V1-default-service class hal user vehicle_network group system inet Loading
automotive/ivn_android_device/impl/default/Android.bp 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package { default_applicable_licenses: ["Android-Apache-2.0"], } cc_library { name: "IvnAndroidDeviceService", vendor_available: true, local_include_dirs: ["include"], export_include_dirs: ["include"], srcs: [ "src/IvnAndroidDeviceService.cpp", ], whole_static_libs: [ "android.hardware.automotive.ivn-V1-ndk", ], shared_libs: [ "libbase", "libbinder_ndk", "libjsoncpp", "liblog", "libutils", ], } cc_binary { name: "android.hardware.automotive.ivn@V1-default-service", vendor: true, relative_install_path: "hw", local_include_dirs: ["include"], srcs: ["src/IvnAndroidDeviceImpl.cpp"], whole_static_libs: ["IvnAndroidDeviceService"], shared_libs: [ "libbase", "libbinder_ndk", "libjsoncpp", "liblog", "libutils", ], required: ["Prebuilt_IvnAndroidDeviceServiceDefaultConfig_JSON"], vintf_fragments: ["ivn-default-service.xml"], init_rc: ["ivn-default-service.rc"], }
automotive/ivn_android_device/impl/default/config/Android.bp 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package { default_applicable_licenses: ["Android-Apache-2.0"], } filegroup { name: "IvnAndroidDeviceServiceDefaultConfig_Json", srcs: ["DefaultConfig.json"], } prebuilt_etc { name: "Prebuilt_IvnAndroidDeviceServiceDefaultConfig_JSON", filename_from_src: true, src: "DefaultConfig.json", sub_dir: "automotive/IvnConfig/", vendor: true, }
automotive/ivn_android_device/impl/default/config/DefaultConfig.json 0 → 100644 +61 −0 Original line number Diff line number Diff line { "MyDeviceId": 0, "Devices": [ { "DeviceId": 0, "OccupantZones": [ { "ZoneId": 0, "OccupantType": "DRIVER", "Seat": 1, "Comments": "Occupant zone for driver and FRONT_LEFT seat" }, { "ZoneId": 1, "OccupantType": "FRONT_PASSENGER", "Seat": 4, "Comments": "Occupant zone for FRONT_RIGHT passenger" } ], "EndpointInfo": { "IpAddress": "10.10.10.1", "PortNumber": 1234, "BrandName": "MyBrand", "DeviceName": "MyDevice", "ProductName": "MyProduct", "ManufacturerName": "MyCompany", "ModelName": "MyModel", "SerialNumber": "Serial1234" }, "Comments": "Device for front row" }, { "DeviceId": 1, "OccupantZones": [ { "ZoneId": 2, "OccupantType": "REAR_PASSENGER", "Seat": 16 }, { "ZoneId": 3, "OccupantType": "REAR_PASSENGER", "Seat": 64 } ], "EndpointInfo": { "IpAddress": "10.10.10.2", "PortNumber": 2345, "BrandName": "MyBrand", "DeviceName": "MyDevice", "ProductName": "MyProduct", "ManufacturerName": "MyCompany", "ModelName": "MyModel", "SerialNumber": "Serial2345" }, "Comments": "Device for back row" } ], "Comment": "This simulates a vehicle with two Android devices, one for front row, one for back row" }
automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h 0 → 100644 +72 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <aidl/android/hardware/automotive/ivn/BnIvnAndroidDevice.h> #include <aidl/android/hardware/automotive/ivn/EndpointInfo.h> #include <aidl/android/hardware/automotive/ivn/OccupantZoneInfo.h> #include <android/binder_auto_utils.h> #include <vector> #include <unordered_map> namespace android { namespace hardware { namespace automotive { namespace ivn { struct DeviceInfo { std::vector<aidl::android::hardware::automotive::ivn::OccupantZoneInfo> occupantZones; aidl::android::hardware::automotive::ivn::EndpointInfo endpointInfo; }; class IvnAndroidDeviceService : public aidl::android::hardware::automotive::ivn::BnIvnAndroidDevice { public: explicit IvnAndroidDeviceService(std::string_view configPath); // Initialize the service, returns true on success. bool init(); ndk::ScopedAStatus getMyDeviceId(int* deviceId) override; ndk::ScopedAStatus getOtherDeviceIds(std::vector<int>* deviceIds) override; ndk::ScopedAStatus getDeviceIdForOccupantZone(int zoneId, int* deviceId) override; ndk::ScopedAStatus getOccupantZonesForDevice( int androidDeviceId, std::vector<aidl::android::hardware::automotive::ivn::OccupantZoneInfo>* occupantZones) override; ndk::ScopedAStatus getMyEndpointInfo( aidl::android::hardware::automotive::ivn::EndpointInfo* endpointInfo) override; ndk::ScopedAStatus getEndpointInfoForDevice( int androidDeviceId, aidl::android::hardware::automotive::ivn::EndpointInfo* endpointInfo) override; private: int mMyDeviceId; std::unordered_map<int, DeviceInfo> mDeviceInfoById; std::string_view mConfigPath; }; } // namespace ivn } // namespace automotive } // namespace hardware } // namespace android
automotive/ivn_android_device/impl/default/ivn-default-service.rc 0 → 100644 +4 −0 Original line number Diff line number Diff line service vendor.ivn-default /vendor/bin/hw/android.hardware.automotive.ivn@V1-default-service class hal user vehicle_network group system inet