diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/cluster_ipc.h | 49 | ||||
-rw-r--r-- | include/ipc_protocol.h | 165 |
2 files changed, 214 insertions, 0 deletions
diff --git a/include/cluster_ipc.h b/include/cluster_ipc.h new file mode 100644 index 0000000..64b731c --- /dev/null +++ b/include/cluster_ipc.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2021, Nippon Seiki Co., Ltd. + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + */ + +#ifndef IPC_H +#define IPC_H + +#include <ipc_protocol.h> + +// Environment Variable for unix-domain-socket file path +#define IPC_ENV_DOMAIN_SOCKET_PATH "IPC_DOMAIN_PATH" + +// return value for API +typedef enum { + IPC_RET_OK = 0, + IPC_ERR_PARAM, + IPC_ERR_SEQUENCE, + IPC_ERR_NO_RESOURCE, + IPC_ERR_OTHER +} IPC_RET_E; + +// format of callback function +typedef void (*IPC_CHANGE_NOTIFY_CB)(void* pData, signed int size, int kind); + +// for Server Function +IPC_RET_E ipcServerStart(IPC_USAGE_TYPE_E usageType); +IPC_RET_E ipcSendMessage(IPC_USAGE_TYPE_E usageType, const void* pData, signed int size); +IPC_RET_E ipcServerStop(IPC_USAGE_TYPE_E usageType); + +// for Client Function +IPC_RET_E ipcClientStart(IPC_USAGE_TYPE_E usageType); +IPC_RET_E ipcReadDataPool(IPC_USAGE_TYPE_E usageType, void* pData, signed int* pSize); +IPC_RET_E ipcRegisterCallback(IPC_USAGE_TYPE_E usageType, IPC_CHANGE_NOTIFY_CB changeNotifyCb); +IPC_RET_E ipcClientStop(IPC_USAGE_TYPE_E usageType); + +#endif // IPC_H diff --git a/include/ipc_protocol.h b/include/ipc_protocol.h new file mode 100644 index 0000000..dc703d0 --- /dev/null +++ b/include/ipc_protocol.h @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2021, Nippon Seiki Co., Ltd. + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + */ + +#ifndef IPC_PROTOCOL_H +#define IPC_PROTOCOL_H + +// TODO: Write something + +typedef enum { + IPC_USAGE_TYPE_IC_SERVICE = 0, + IPC_USAGE_TYPE_FOR_TEST, + IPC_USAGE_TYPE_MAX +} IPC_USAGE_TYPE_E; + +// for IPC_USAGE_TYPE_IC_SERVICE +typedef enum { + IPC_KIND_ICS_TURN_R = 0, + IPC_KIND_ICS_TURN_L, + IPC_KIND_ICS_BRAKE, + IPC_KIND_ICS_SEATBELT, + IPC_KIND_ICS_HIGHBEAM, + IPC_KIND_ICS_DOOR, + IPC_KIND_ICS_EPS, + IPC_KIND_ICS_SRS_AIRBAG, + IPC_KIND_ICS_ABS, + IPC_KIND_ICS_LOW_BATTERY, + IPC_KIND_ICS_OIL_PRESS, + IPC_KIND_ICS_ENGINE, + IPC_KIND_ICS_FUEL, + IPC_KIND_ICS_IMMOBI, + IPC_KIND_ICS_TM_FAIL, + IPC_KIND_ICS_ESP_ACT, + IPC_KIND_ICS_ESP_OFF, + IPC_KIND_ICS_ADAPTING_LIGHTING, + IPC_KIND_ICS_AUTO_STOP, + IPC_KIND_ICS_AUTO_STOP_FAIL, + IPC_KIND_ICS_PARKING_LIGHTS, + IPC_KIND_ICS_FRONT_FOG, + IPC_KIND_ICS_EXTERIOR_LIGHT_FAULT, + IPC_KIND_ICS_ACC_FAIL, + IPC_KIND_ICS_LDW_OFF, + IPC_KIND_ICS_HILL_DESCENT, + IPC_KIND_ICS_AUTO_HI_BEAM_GREEN, + IPC_KIND_ICS_AUTO_HI_BEAM_AMBER, + IPC_KIND_ICS_LDW_OPERATE, + IPC_KIND_ICS_GENERAL_WARN, + IPC_KIND_ICS_SPORTS_MODE, + IPC_KIND_ICS_DRIVING_POWER_MODE, + IPC_KIND_ICS_HOT_TEMP, + IPC_KIND_ICS_LOW_TEMP +} IPC_KIND_IC_SERVICE_E; + +typedef struct { + // Telltale + signed int turnR; + signed int turnL; + signed int brake; + signed int seatbelt; + signed int frontRightSeatbelt; + signed int frontCenterSeatbelt; + signed int frontLeftSeatbelt; + signed int mid1RightSeatbelt; + signed int mid1CenterSeatbelt; + signed int mid1LeftSeatbelt; + signed int mid2RightSeatbelt; + signed int mid2CenterSeatbelt; + signed int mid2LeftSeatbelt; + signed int rearRightSeatbelt; + signed int rearCenterSeatbelt; + signed int rearLeftSeatbelt; + signed int highbeam; + signed int door; + signed int frontRightDoor; + signed int frontLeftDoor; + signed int rearRightDoor; + signed int rearLeftDoor; + signed int trunkDoor; + signed int hoodDoor; + signed int eps; + signed int srsAirbag; + signed int abs; + signed int lowBattery; + signed int oilPress; + signed int engine; + signed int fuel; + signed int immobi; + signed int tmFail; + signed int espAct; + signed int espOff; + signed int adaptingLighting; + signed int autoStop; + signed int autoStopFail; + signed int parkingLights; + signed int frontFog; + signed int exteriorLightFault; + signed int accFail; + signed int ldwOff; + signed int hillDescent; + signed int autoHiBeamGreen; + signed int autoHiBeamAmber; + signed int sportsMode; + signed int ldwOperate; + signed int generalWarn; + signed int drivingPowerMode; + signed int hotTemp; + signed int lowTemp; + + // ShiftPosition + signed int gearAtVal; + signed int gearMtVal; + + // Speed + unsigned long spAnalogVal; + signed int spAnaDigUnitVal; + + // Tacho + unsigned long taAnalogVal; + + // TripComputer + unsigned long trcomTripAVal; + unsigned long trcomTripBVal; + unsigned long trcomOdoVal; + signed int trcomUnitVal; + unsigned short avgSpeedAVal; + unsigned short avgSpeedBVal; + unsigned short hourAVal; + unsigned short hourBVal; + unsigned char minuteAVal; + unsigned char minuteBVal; + unsigned char secondAVal; + unsigned char secondBVal; + signed short oTempVal; + signed int oTempUnitVal; + unsigned short cruRangeVal; + unsigned short avgFuelAVal; + unsigned short avgFuelBVal; + unsigned short insFuelAVal; + unsigned short insFuelBVal; + signed int fuelEconomyUnitVal; +} IPC_DATA_IC_SERVICE_S; + +// for IPC_USAGE_TYPE_FOR_TEST +typedef enum { + IPC_KIND_TEST_TEST = 0 +} IPC_KIND_FOR_TEST_E; + +typedef struct { + signed int test; +} IPC_DATA_FOR_TEST_S; + +#endif // IPC_PROTOCOL_H |