diff options
author | 2020-03-30 09:36:53 +0900 | |
---|---|---|
committer | 2020-03-30 09:36:53 +0900 | |
commit | c32108fe1bb212667de414db5fb34d61535b6684 (patch) | |
tree | c95299a361d8b8c81583cb00887c0560f631e0dd /vehicle_parameter_library/library | |
parent | 706ad73eb02caf8532deaf5d38995bd258725cb8 (diff) |
os-vehicleparameterlibrary branch
Diffstat (limited to 'vehicle_parameter_library/library')
11 files changed, 1958 insertions, 0 deletions
diff --git a/vehicle_parameter_library/library/Makefile b/vehicle_parameter_library/library/Makefile new file mode 100644 index 00000000..dc06ae26 --- /dev/null +++ b/vehicle_parameter_library/library/Makefile @@ -0,0 +1,37 @@ +# +# @copyright Copyright (c) 2017-2019 TOYOTA MOTOR CORPORATION. +# +# 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. +# + +INST_SHLIBS = libvp + +VPATH = ./src ./include/$(COMPONENT_NAME) + +INST_HEADERS = VP_GetEnv.h env_vehicle.h \ + env_vehicleparameterlibrary.h env_vehicleparameterlibrary_serial.h env_ext.h \ + VP_FuncCheck_CanRcv.h vehicle_parameter_library.h + +libvp_SRCS = VP_FuncCheck_CanRcv.c VP_GetEnv.c + +CPPFLAGS += -I./include + +CPPFLAGS += -Werror=implicit-function-declaration +CPPFLAGS += -Werror=format-security +CPPFLAGS += -Wconversion +CPPFLAGS += -Wpointer-to-int-cast +CPPFLAGS += -Wint-to-pointer-cast +CPPFLAGS += -Wpointer-arith +CPPFLAGS += -Wformat + +include ../../other_service.mk diff --git a/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h b/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h new file mode 100644 index 00000000..b020f5c2 --- /dev/null +++ b/vehicle_parameter_library/library/include/VP_FuncCheck_CanRcv_private.h @@ -0,0 +1,90 @@ +/* + * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/* ====================================================================== */ +/** + * @file VP_FuncCheck_CanRcv_private.h + * @brief Get function existence API internal header file + * @attention Cannot be included from external functions + * + * Exported because it will be inconvenient at MT + */ +/* ====================================================================== */ + +#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_VP_FUNCCHECK_CANRCV_PRIVATE_H_ +#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_VP_FUNCCHECK_CANRCV_PRIVATE_H_ + +/* ====================================================================== */ +/* Include public headers */ +/* ====================================================================== */ +#include <other_service/VP_FuncCheck_CanRcv.h> + +/* ====================================================================== */ +/* Internal definitions for debugging */ +/* ====================================================================== */ +#ifdef DEBUG_MT + #include <stdio.h> + + #define MT_STATIC /**< Static definitions - Remove the static in order to remove the file scope at MT. */ + + /**< Debugging output function - Compile the entity at MT */ + #define DEBUG_PRINT(msg) {printf("%s\n", (msg) ) ;} + /**< Debugging output function - Compile the entity at MT */ + #define DEBUG_PRINTF(format, msg) {printf((format), (msg) ) ;} + + /**< Static assertion */ + #define VP_DEBUG_STATIC_ASSERT(expr) do { int static_assert[ (expr)? 1:-1 ]; }while(0); +#else + /**< Static definitions. The scope shall be limited by static at the time of releasing. + * Remove the static in order to remove the file scope at MT. + */ + #define MT_STATIC static + + /**< Static definitions. The scope shall be limited by static at the time of releasing. + * Remove the static in order to remove the file scope at MT. + */ + #define DEBUG_PRINT(msg) + + /**< Static definitions. The scope shall be limited by static at the time of releasing. + * Remove the static in order to remove the file scope at MT. + */ + #define DEBUG_PRINTF(format, msg) + + /**< Static definitions. The scope shall be limited by static at the time of releasing. + * Remove the static in order to remove the file scope at MT. + */ + #define VP_DEBUG_STATIC_ASSERT(expr) +#endif + +/* ====================================================================== */ +/* General-purpose type definition - Redifined for internal use */ +/* ====================================================================== */ +/**< Internal boolean type - sys/type.h has no type definitions, so defined it here. FCCR: "F"unc"C"heck_"C"an"R"cv */ +typedef enum VP_FCCR_BOOL_Tag { + B_FALSE, /**< FALSE */ + B_TRUE /**< TRUE */ +} VP_FCCR_BOOL; + + +/* ====================================================================== */ +/* Structure */ +/* ====================================================================== */ +typedef struct TABLE_INDEX_INFO_tag { + char* code_str; /**< String that can be gotten from vehicle parameters */ + unsigned int index; /**< Index for function existence */ +} TABLE_INDEX_INFO; + +#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_VP_FUNCCHECK_CANRCV_PRIVATE_H_ diff --git a/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h b/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h new file mode 100644 index 00000000..9e9e73fc --- /dev/null +++ b/vehicle_parameter_library/library/include/other_service/VP_FuncCheck_CanRcv.h @@ -0,0 +1,131 @@ +/* + * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/* ====================================================================== */ +/** + * @file VP_FuncCheck_CanRcv.h + * @brief \~english Get function existence API header file + */ +/* ====================================================================== */ + +#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_FUNCCHECK_CANRCV_H_ +#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_FUNCCHECK_CANRCV_H_ + +#include <sys/types.h> + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup other_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup vehicle_parameter_library + * @ingroup other_service + * @{ + */ + +// typedef unsigned char u_int8; + + +/** +* @~english XM Audio +*/ +#define XM_AUDIO ((u_int8_t)1) +/** +* @~english _CWORD76_ +*/ +#define _CWORD76_ ((u_int8_t)2) + +/** +* @~english HD Data (Include traffic) +*/ +#define VP_CANRCV__CWORD27_ ((u_int8_t)3) /**< _CWORD27_ */ +/** +* @~english WiFi HotSpot +*/ +#define WIFI_HOTSPOT ((u_int8_t)4) +/** +* @~english standard driving rregulation of AREA1 +*/ +#define AREA1_STD_TRAF_LIMIT ((u_int8_t)5) +/** +* @~english HD Data (Include traffic) +*/ +#define HD_DATA ((u_int8_t)6) + +/** +* @~english definiton of return value of API(VP_FuncCheck_CanRcv),which is used to get status of function implemention +*/ +#define FUNCTION_CHECK_RESULT_OK ((u_int8_t)0) +/** +* @~english this function is invalid +*/ +#define FUNCTION_CHECK_RESULT_NG ((u_int8_t)1) +/** +* @~english this function does not exist +*/ +#define FUNCTION_CHECK_RESULT_UNKNOWN ((u_int8_t)2) +/** +* @~english reference out of AREA1 +*/ +#define FUNCTION_CHECK_RESULT_OUT_OF_AREA1 ((u_int8_t)3) + +/* Function prototype declaration */ +#ifdef __cplusplus +extern "C" { +#endif + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup VP_FuncCheck_CanRcv +/// \~english @par Brief +/// VP_FuncCheck_CanRcv +/// \~english @param [in] FunctionName +/// function name +/// \~english @retval FUNCTION_CHECK_RESULT_OK: This function is available +/// \~english @retval FUNCTION_CHECK_RESULT_NG: This function is unavailable +/// \~english @retval FUNCTION_CHECK_RESULT_UNKNOWN: This function does not exist +/// \~english @par Prerequisite +/// None +/// \~english @par Change of internal state +/// None +/// \~english @par Conditions of processing failure +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync Only +/// \~english @par Detail +/// - To get the function check result from +/// - vehicle parameter:CAN info judge +/// - vehicle parameter:country ID +/// - country ID and function judge info in API +/// - When vehicle parameter:CAN info judge +/// is [CAN_judge] or [country_ID], +/// and if country_ID is unacquainted or undefined, the API returns [available]. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////// +u_int8_t VP_FuncCheck_CanRcv(u_int8_t FunctionName); + +#ifdef __cplusplus +} +#endif + +/** @}*/ // end of vehicle_parameter_library +/** @}*/ // end of other_service +/** @}*/ // end of BaseSystem + +#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_FUNCCHECK_CANRCV_H_ diff --git a/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h b/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h new file mode 100644 index 00000000..50696f75 --- /dev/null +++ b/vehicle_parameter_library/library/include/other_service/VP_GetEnv.h @@ -0,0 +1,124 @@ +/* + * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/* ====================================================================== */ +/** + * @file VP_GetEnv.h + * @brief \~english Get vehicle parameter environment variable API header file + */ +/* ====================================================================== */ + +#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_GETENV_H_ +#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_GETENV_H_ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup other_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup vehicle_parameter_library + * @ingroup other_service + * @{ + */ +#include <other_service/env_ext.h> + +/** +* @~english the max length of vehicle parameter environment viarable +*/ + +#define VP_MAX_LENGTH 128 + +/** +* @~english definition of parameter environment viarable such as destination +* destination diff +*/ + +#define VEHICLEPARAMETERLIBRARY_AREA "VEHICLEPARAMETERLIBRARY_AREA" + +/** +* @~english grade diff +*/ +#define VEHICLEPARAMETERLIBRARY_GRADE "VEHICLEPARAMETERLIBRARY_GRADE" + +/** +* @~english brand diff +*/ +#define VEHICLEPARAMETERLIBRARY_BRAND "VEHICLEPARAMETERLIBRARY_BRAND" + +/** +* @~english board type +*/ +#define VEHICLEPARAMETERLIBRARY_BOARD "VEHICLEPARAMETERLIBRARY_BOARD" + +/** +* @~english definition of _CWORD31_ vehicle parameter environment viarable +*/ +#include <other_service/env_vehicle.h> + +/** +* @~english definition of vehicle parameter environment viarable +*/ +#include <other_service/env_vehicleparameterlibrary.h> + +/** +* @~english definition of Serial vehicle parameter environment viarable +*/ +#include <other_service/env_vehicleparameterlibrary_serial.h> + +/* Function prototype declaration */ +#ifdef __cplusplus +extern "C" { +#endif + +//////////////////////////////////////////////////////////////////////////////// +/// \ingroup VP_GetEnv +/// \~english @par Brief +/// VP_GetEnv +/// \~english @param [in] pEnvStr +/// The pointer of environment variable name string +/// \~english @param [out] pEnvBuff +/// The head address of saving environment variable value +/// \~english @retval None +/// \~english @par Prerequisite +/// None +/// \~english @par Change of internal state +/// None +/// \~english @par Conditions of processing failure +/// None +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync Only +/// \~english @par Detail +/// - To get the environment variable value by the environment variable name, +/// and save it in pEnvBuff. +/// - When environment variable name is NULL or an undefined value, +/// a blank string shall be saved in pEnvBuff. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////// +void VP_GetEnv(const char *pEnvStr, char *pEnvBuff); + +#ifdef __cplusplus +} +#endif + +/** @}*/ // end of vehicle_parameter_library +/** @}*/ // end of other_service +/** @}*/ // end of BaseSystem + +#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_VP_GETENV_H_ diff --git a/vehicle_parameter_library/library/include/other_service/env_ext.h b/vehicle_parameter_library/library/include/other_service/env_ext.h new file mode 100644 index 00000000..d28ef256 --- /dev/null +++ b/vehicle_parameter_library/library/include/other_service/env_ext.h @@ -0,0 +1,45 @@ +/* + * @copyright Copyright (c) 2019 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/** + * @file env_ext.h + * @brief \~english Define of supplier vehicle parameter environment variable. + */ + +#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_EXT_H_ +#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_EXT_H_ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup other_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup vehicle_parameter_library + * @ingroup other_service + * @{ + */ + +// +// Please describe supplier-specific definitions of the vehicle parameters. +// + +/** @}*/ // end of vehicle_parameter_library +/** @}*/ // end of other_service +/** @}*/ // end of BaseSystem + +#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_EXT_H_ diff --git a/vehicle_parameter_library/library/include/other_service/env_vehicle.h b/vehicle_parameter_library/library/include/other_service/env_vehicle.h new file mode 100644 index 00000000..f3227f9f --- /dev/null +++ b/vehicle_parameter_library/library/include/other_service/env_vehicle.h @@ -0,0 +1,354 @@ +/* + * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/** + * @file env_vehicle.h + * @brief \~english Define of _CWORD31_ vehicle parameter environment variable + */ + +#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLE_H_ +#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLE_H_ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup other_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup vehicle_parameter_library + * @ingroup other_service + * @{ + */ + +/** +* @~english _CWORD31_ version +*/ +#define VP__CWORD31__VERSION "VP__CWORD31__version" +/** +* @~english _CWORD31_ class type of LAN +*/ + +#define VP__CWORD31__CLASS_TYPE_OF_LAN "VP__CWORD31__class_type_of_LAN" +/** +* @~english _CWORD31_ reverse signal +*/ + +#define VP__CWORD31__REVERSE "VP__CWORD31__reverse" +/** +* @~english _CWORD31_ PKB signal +*/ + +#define VP__CWORD31__PKB "VP__CWORD31__PKB" +/** +* @~english _CWORD31_ ADIM signal of _CWORD62_ +*/ + +#define VP__CWORD31__ADIM__CWORD62_ "VP__CWORD31__ADIM__CWORD62_" +/** +* @~english _CWORD31_ telematics function +*/ + +#define VP__CWORD31__TELEMATICS_FUNCTION "VP__CWORD31__telematics_function" +/** +* @~english _CWORD31_ opening picture +*/ + +#define VP__CWORD31__OPENING_PICTURE "VP__CWORD31__opening_picture" +/** +* @~english _CWORD31_ theme color +*/ + +#define VP__CWORD31__THEME_COLOR "VP__CWORD31__theme_color" +/** +* @~english _CWORD31_ air conditioner on screen +*/ +#define VP__CWORD31__AC_ONSCREEN "VP__CWORD31__AC_onscreen" +/** +* @~english _CWORD31_ air conditioner screen operation +*/ +#define VP__CWORD31__AC_SCREEN_OPERATION "VP__CWORD31__AC_screen_operation" +/** +* @~english _CWORD31_ air conditioner home screen +*/ +#define VP__CWORD31__AC_SCREEN_HOME "VP__CWORD31__AC_screen_home" +/** +* @~english _CWORD31_ air conditioner switch front temperature +*/ +#define VP__CWORD31__AC_SWITCH_FRONT_TEMP "VP__CWORD31__AC_switch_front_temp" +/** +* @~english _CWORD31_ air conditioner display of outside temperature +*/ +#define VP__CWORD31__AC_TEMP_DISP_OUTSIDE "VP__CWORD31__AC_temp_disp_outside" +/** +* @~english _CWORD31_ air conditioner setting of display +*/ +#define VP__CWORD31__AC_TEMP_DISP_SETTING "VP__CWORD31__AC_temp_disp_setting" +/** +* @~english _CWORD31_ air conditioner switch concierge +*/ +#define VP__CWORD31__AC_SWITCH_CONCIERGE "VP__CWORD31__AC_switch_concierge" +/** +* @~english S flow of _CWORD31_ air conditioner switch +*/ +#define VP__CWORD31__AC_SWITCH_S_FLOW "VP__CWORD31__AC_switch_S_flow" +/** +* @~english _CWORD31_ _CWORD113_ +*/ +#define VP__CWORD31___CWORD11_ "VP__CWORD31___CWORD11_" +/** +* @~english _CWORD31_ EF home screen +*/ +#define VP__CWORD31___CWORD11__HOME "VP__CWORD31___CWORD11__home" +/** +* @~english _CWORD31_ drive wheel of _CWORD113_ +*/ +#define VP__CWORD31___CWORD11__DRIVE_WHEEL "VP__CWORD31___CWORD11__drive_wheel" +/** +* @~english _CWORD31_ drive type of _CWORD113_ +*/ +#define VP__CWORD31___CWORD11__DRIVE_TYPE "VP__CWORD31___CWORD11__drive_type" +/** +* @~english _CWORD31_ battery position of _CWORD113_ +*/ +#define VP__CWORD31___CWORD11__BATTERY_POSITION "VP__CWORD31___CWORD11__battery_position" +/** +* @~english _CWORD31_ battery direction of _CWORD113_ +*/ +#define VP__CWORD31___CWORD11__BATTERY_DIRECTION "VP__CWORD31___CWORD11__battery_direction" +/** +* @~english _CWORD31_ motor position of _CWORD113_ +*/ +#define VP__CWORD31___CWORD11__MOTOR_POSITION "VP__CWORD31___CWORD11__motor_position" +/** +* @~english _CWORD31_ _CWORD112_ trip +*/ +#define VP__CWORD31___CWORD9__TRIP "VP__CWORD31___CWORD9__trip" +/** +* @~english _CWORD31_ FC home screen trip +*/ +#define VP__CWORD31___CWORD9__HOME_TRIP "VP__CWORD31___CWORD9__home_trip" +/** +* @~english _CWORD31_ _CWORD112_ fuel +*/ +#define VP__CWORD31___CWORD9__FUEL "VP__CWORD31___CWORD9__fuel" +/** +* @~english _CWORD31_ FC home screen fuel +*/ +#define VP__CWORD31___CWORD9__HOME_FUEL "VP__CWORD31___CWORD9__home_fuel" +/** +* @~english _CWORD31_ FC eco safety point service +*/ +#define VP__CWORD31__FC_ECO_SAFETY_POINT_SERVICE "VP__CWORD31__FC_eco_safety_point_service" +/** +* @~english _CWORD31_ FC GAS scale +*/ +#define VP__CWORD31__FC_SCALE_GAS "VP__CWORD31__FC_scale_GAS" +/** +* @~english _CWORD31_ FC HV scale +*/ +#define VP__CWORD31__FC_SCALE_HV "VP__CWORD31__FC_scale_HV" +/** +* @~english _CWORD31_ FC energy mark +*/ +#define VP__CWORD31__FC_ENERGY_MARK "VP__CWORD31__FC_energy_mark" +/** +* @~english _CWORD31_ _CWORD112_ type +*/ +#define VP__CWORD31___CWORD9__TYPE "VP__CWORD31___CWORD9__type" +/** +* @~english _CWORD31_ FC signal +*/ +#define VP__CWORD31__FC_SIGNAL "VP__CWORD31__FC_SIGNAL" +/** +* @~english _CWORD31_ display setting screen +*/ +#define VP__CWORD31__DISPLAY_SETTING_SCREEN "VP__CWORD31__display_setting_screen" +/** +* @~english _CWORD31_ VR HVAC control +*/ +#define VP__CWORD31__VR_HVAC_CONTROL "VP__CWORD31__VR_HVAC_control" +/** +* @~english _CWORD31_ clock type +*/ +#define VP__CWORD31__CLOCK_TYPE "VP__CWORD31__clock_type" +/** +* @~english _CWORD31_ start up BGM +*/ +#define VP__CWORD31__START_UP_BGM "VP__CWORD31__start_up_BGM" +/** +* @~english _CWORD31_ start up BGM type +*/ +#define VP__CWORD31__START_UP_BGM_TYPE "VP__CWORD31__start_up_BGM_type" +/** +* @~english _CWORD31_ font left DTV antenna +*/ +#define VP__CWORD31__DTV_ANTENNA_FL "VP__CWORD31__DTV_antenna_FL" +/** +* @~english _CWORD31_ font right DTV antenna +*/ +#define VP__CWORD31__DTV_ANTENNA_FR "VP__CWORD31__DTV_antenna_FR" +/** +* @~english _CWORD31_ rear left DTV antenna +*/ +#define VP__CWORD31__DTV_ANTENNA_RL "VP__CWORD31__DTV_antenna_RL" +/** +* @~english _CWORD31_ rear right DTV antenna +*/ +#define VP__CWORD31__DTV_ANTENNA_RR "VP__CWORD31__DTV_antenna_RR" +/** +* @~english _CWORD31_ DTV antenna +*/ +#define VP__CWORD31__DTV_ANTENNA "VP__CWORD31__DTV_antenna" +/** +* @~english _CWORD31_ HF voice quality type +*/ +#define VP__CWORD31__HF_VOICE_QUALITY_TYPE "VP__CWORD31__HF_voice_quality_type" +/** +* @~english _CWORD31_ tune knob push +*/ +#define VP__CWORD31__TUNE_KNOB_PUSH "VP__CWORD31__tune_knob_push" +/** +* @~english _CWORD31_ screen switch seek +*/ +#define VP__CWORD31__SCREEN_SWITCH_SEEK "VP__CWORD31__screen_switch_seek" +/** +* @~english _CWORD31_ DAB antenna +*/ +#define VP__CWORD31__DAB_ANTENNA "VP__CWORD31__DAB_antenna" +/** +* @~english _CWORD31_ hard switch beep +*/ +#define VP__CWORD31__HARD_SWITCH_BEEP "VP__CWORD31__hard_switch_beep" +/** +* @~english _CWORD31_ screen switch beep +*/ +#define VP__CWORD31__SCREEN_SWITCH_BEEP "VP__CWORD31__screen_switch_beep" +/** +* @~english _CWORD31_ steering switch type +*/ +#define VP__CWORD31__STEERING_SWITCH_TYPE "VP__CWORD31__steering_switch_type" +/** +* @~english _CWORD31_ TEL switch of steering +*/ +#define VP__CWORD31__STEERING_SWITCH_TEL "VP__CWORD31__steering_switch_tel" +/** +* @~english _CWORD31_ class circuit mode +*/ +#define VP__CWORD31__CLASS_CIRCUIT_MODE "VP__CWORD31__class_circuit_mode" +/** +* @~english _CWORD31_ _CWORD67_ warning +*/ +#define VP__CWORD31___CWORD67__WARNING "VP__CWORD31___CWORD67__warning" +/** +* @~english _CWORD31_ _CWORD67_ accelerator +*/ +#define VP__CWORD31___CWORD67__ACCELERATOR "VP__CWORD31___CWORD67__accelerator" +/** +* @~english _CWORD31_ panel microcomputer +*/ +#define VP__CWORD31__PANEL_MICROCOMPUTER "VP__CWORD31__panel_microcomputer" +/** +* @~english _CWORD31_ class watch at brake hold +*/ +#define VP__CWORD31__CLASS_WATCH_AT_BRAKE_HOLD "VP__CWORD31__class_watch_at_brake_hold" +/** +* @~english _CWORD31_ GPS antenna +*/ +#define VP__CWORD31__GPS_ANTENNA "VP__CWORD31__GPS_antenna" +/** +* @~english _CWORD31_ illumination vehicle signal +*/ +#define VP__CWORD31__VEHICLE_SIGNAL_ILL "VP__CWORD31__vehicle_signal_ILL" +/** +* @~english _CWORD31_ switch trigger +*/ +#define VP__CWORD31__SWITCH_TRIGGER "VP__CWORD31__switch_trigger" +/** +* @~english _CWORD31_ sensitivity level +*/ +#define VP__CWORD31__SENSITIVITY_LEVEL "VP__CWORD31__sensitivity_level" +/** +* @~english _CWORD31_ invalidity term +*/ +#define VP__CWORD31__INVALIDITY_TERM "VP__CWORD31__invalidity_term" +/** +* @~english _CWORD31_ thumbnail type +*/ +#define VP__CWORD31__THUMBNAIL_TYPE "VP__CWORD31__thumbnail_type" +/** +* @~english _CWORD31_ BT device name +*/ +#define VP__CWORD31__BT_DEVICE_NAME "VP__CWORD31__BT_device_name" +/** +* @~english _CWORD31_ eco drive max volume +*/ +#define VP__CWORD31__ECO_DRIVE_MAX_VOLUME "VP__CWORD31__eco_drive_max_volume" +/** +* @~english _CWORD31_ EOM function +*/ +#define VP__CWORD31__EOM_FUNCTION "VP__CWORD31__EOM_function" +/** +* @~english _CWORD31_ Microphone Type +*/ +#define VP__CWORD31__MICROPHONE_TYPE "VP__CWORD31__Microphone_Type" +/** +* @~english _CWORD31_ Microphone Location +*/ +#define VP__CWORD31__MICROPHONE_LOCATION "VP__CWORD31__Microphone_Location" +/** +* @~english _CWORD31_ wide band FM +*/ +#define VP__CWORD31__WIDE_BAND_FM "VP__CWORD31__Wide_band_FM" + +#define VP__CWORD31__MAP_COLOR "VP__CWORD31__map_color" +#define VP__CWORD31__CLOUD_ECO "VP__CWORD31__cloud_eco" +#define VP__CWORD31__EG_TYPE "VP__CWORD31__EG_type" + +/** +* @~english _CWORD31_ display type +*/ +#define VP__CWORD31__DISPLAY_TYPE "VP__CWORD31__display_type" +/** +* @~english _CWORD31_ clock display +*/ +#define VP__CWORD31__CLOCK_DISPLAY "VP__CWORD31__clock_display" +/** +* @~english _CWORD31_ destination +*/ +#define VP__CWORD31__DESTINATION "VP__CWORD31__destination" +/** +* @~english _CWORD31_ class operation +*/ +#define VP__CWORD31__CLASS_OPERATION "VP__CWORD31__class_operation" +/** +* @~english _CWORD31_ opening interval +*/ +#define VP__CWORD31__OPENING_INTERVAL "VP__CWORD31__opening_interval" +/** +* @~english _CWORD31_ DES function +*/ +#define VP__CWORD31__DES_FUNCTION "VP__CWORD31__DES_function" +/** +* @~english _CWORD31_ beep sound keys +*/ +#define VP__CWORD31__BEEP_SOUND_KEYS "VP__CWORD31__beep_sound_keys" + +/** @}*/ // end of vehicle_parameter_library +/** @}*/ // end of other_service +/** @}*/ // end of BaseSystem + +#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLE_H_ diff --git a/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h b/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h new file mode 100644 index 00000000..bbe49917 --- /dev/null +++ b/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary.h @@ -0,0 +1,272 @@ +/* + * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/** + * @file env_vehicleparameterlibrary.h + * @brief \~english Define of vehicle parameter environment variable + */ + +#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_H_ +#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_H_ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup other_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup vehicle_parameter_library + * @ingroup other_service + * @{ + */ + +/** +* @~english version +*/ +#define VP_VEHICLEPARAMETERLIBRARY_VERSION "VP_VEHICLEPARAMETERLIBRARY_version" +/** +* @~english ID +*/ +#define VP_VEHICLEPARAMETERLIBRARY_VEHICLEPARAMETERLIBRARY_ID "VP_VEHICLEPARAMETERLIBRARY_vehicleparameterlibrary_ID" +/** +* @~english maker ID +*/ +#define VP_VEHICLEPARAMETERLIBRARY_MAKER_ID "VP_VEHICLEPARAMETERLIBRARY_maker_ID" +/** +* @~english area +*/ +#define VP_VEHICLEPARAMETERLIBRARY_AREA "VP_VEHICLEPARAMETERLIBRARY_area" +/** +* @~english grade +*/ +#define VP_VEHICLEPARAMETERLIBRARY_GRADE "VP_VEHICLEPARAMETERLIBRARY_grade" +/** +* @~english model ID +*/ +#define VP_VEHICLEPARAMETERLIBRARY_MODEL_ID "VP_VEHICLEPARAMETERLIBRARY_model_ID" +/** +* @~english destination country code +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DEST_C_CODE "VP_VEHICLEPARAMETERLIBRARY_dest_c_code" +/** +* @~english radio tuner number +*/ +#define VP_VEHICLEPARAMETERLIBRARY_RADIO_TUNER_NUM "VP_VEHICLEPARAMETERLIBRARY_radio_tuner_num" +/** +* @~english radio antenna number +*/ +#define VP_VEHICLEPARAMETERLIBRARY_RADIO_ANTENNA_NUM "VP_VEHICLEPARAMETERLIBRARY_radio_antenna_num" +/** +* @~english DAB tuner number +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DAB_TUNER_NUM "VP_VEHICLEPARAMETERLIBRARY_DAB_tuner_num" +/** +* @~english DAB sub antenna +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DAB_SUB_ANTENNA "VP_VEHICLEPARAMETERLIBRARY_DAB_sub_antenna" +/** +* @~english _CWORD32_ DAB +*/ +#define VP_VEHICLEPARAMETERLIBRARY__CWORD32__DAB "VP_VEHICLEPARAMETERLIBRARY__CWORD32__DAB" +/** +* @~english cache radio +*/ +#define VP_VEHICLEPARAMETERLIBRARY_CACHERADIO "VP_VEHICLEPARAMETERLIBRARY_CacheRadio" +/** +* @~english amp type +*/ +#define VP_VEHICLEPARAMETERLIBRARY_AMP_TYPE "VP_VEHICLEPARAMETERLIBRARY_AMP_type" +/** +* @~english op cooperation +*/ +#define VP_VEHICLEPARAMETERLIBRARY_OP_COOPERATION "VP_VEHICLEPARAMETERLIBRARY_OP_cooperation" +/** +* @~english display +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DISPLAY "VP_VEHICLEPARAMETERLIBRARY_DISPLAY" +/** +* @~english touch panel +*/ +#define VP_VEHICLEPARAMETERLIBRARY_TOUCHPANEL "VP_VEHICLEPARAMETERLIBRARY_TOUCHPANEL" +/** +* @~english DECK +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DECK "VP_VEHICLEPARAMETERLIBRARY_DECK" +/** +* @~english display mode +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DEFAULT_MODE "VP_VEHICLEPARAMETERLIBRARY_default_mode" +/** +* @~english voice recognition tutorial +*/ +#define VP_VEHICLEPARAMETERLIBRARY_VOICE_RECOGNITION_TUTORIAL "VP_VEHICLEPARAMETERLIBRARY_VOICE_RECOGNITION_TUTORIAL" +/** +* @~english search +*/ +#define VP_VEHICLEPARAMETERLIBRARY_SEARCH "VP_VEHICLEPARAMETERLIBRARY_SEARCH" +/** +* @~english contact +*/ +#define VP_VEHICLEPARAMETERLIBRARY_CONTACT "VP_VEHICLEPARAMETERLIBRARY_CONTACT" +/** +* @~english JP traffic information show +*/ +#define VP_VEHICLEPARAMETERLIBRARY_JPTRAFFICINFO_SHOW "VP_VEHICLEPARAMETERLIBRARY_JPTrafficInfo_show" +/** +* @~english information management +*/ +#define VP_VEHICLEPARAMETERLIBRARY_INFOMATION_MANAGEMENT "VP_VEHICLEPARAMETERLIBRARY_INFOMATION_MANAGEMENT" +/** +* @~english sub screen apps show +*/ +#define VP_VEHICLEPARAMETERLIBRARY_SUBSCREEN_APPS_SW "VP_VEHICLEPARAMETERLIBRARY_SUBSCREEN_APPS_SW" +/** +* @~english WIFI STA enable +*/ +#define VP_VEHICLEPARAMETERLIBRARY_WIFI_STA_ENABLE "VP_VEHICLEPARAMETERLIBRARY_WIFI_STA_ENABLE" +/** +* @~english WIFI AP enable +*/ +#define VP_VEHICLEPARAMETERLIBRARY_WIFI_AP_ENABLE "VP_VEHICLEPARAMETERLIBRARY_WIFI_AP_ENABLE" +/** +* @~english WIFI DIRECT enable +*/ +#define VP_VEHICLEPARAMETERLIBRARY_WIFI_DIRECT_ENABLE "VP_VEHICLEPARAMETERLIBRARY_WIFI_DIRECT_ENABLE" +/** +* @~english has GPS +*/ +#define VP_VEHICLEPARAMETERLIBRARY_HAS_GPS "VP_VEHICLEPARAMETERLIBRARY_HAS_GPS" +/** +* @~english default status is has _CWORD80_ +*/ +#define VP_VEHICLEPARAMETERLIBRARY__CWORD6_ "VP_VEHICLEPARAMETERLIBRARY__CWORD6_" +/** +* @~english phase +*/ +#define VP_VEHICLEPARAMETERLIBRARY_PHASE "VP_VEHICLEPARAMETERLIBRARY_PHASE" +/** +* @~english certification soft +*/ +#define VP_VEHICLEPARAMETERLIBRARY_CERTIFICATION_SOFT "VP_VEHICLEPARAMETERLIBRARY_CERTIFICATION_SOFT" +/** +* @~english _CWORD116_ +*/ +#define VP_VEHICLEPARAMETERLIBRARY__CWORD6_ "VP_VEHICLEPARAMETERLIBRARY__CWORD6_" +/** +* @~english voice tags +*/ +#define VP_VEHICLEPARAMETERLIBRARY_VOICE_TAGS "VP_VEHICLEPARAMETERLIBRARY_VOICE_TAGS" +/** +* @~english BT HFP +*/ +#define VP_VEHICLEPARAMETERLIBRARY_BT_2HFP "VP_VEHICLEPARAMETERLIBRARY_BT_2HFP" +/** +* @~english connection server +*/ +#define VP_VEHICLEPARAMETERLIBRARY_CONNECTION_SERVER "VP_VEHICLEPARAMETERLIBRARY_CONNECTION_SERVER" +/** +* @~english frameworkunifiedlog ENC key type +*/ +#define VP_VEHICLEPARAMETERLIBRARY_VEHICLEPARAMETERLIBRARYLOG_ENC_KEYTYPE "VP_VEHICLEPARAMETERLIBRARY_VEHICLEPARAMETERLIBRARYLOG_ENC_KEYTYPE" +/** +* @~english destination vol 1 +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DES_VOL_1 "VP_VEHICLEPARAMETERLIBRARY_DES_VOL_1" +/** +* @~english destination vol 2 +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DES_VOL_2 "VP_VEHICLEPARAMETERLIBRARY_DES_VOL_2" +/** +* @~english destination vol 3 +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DES_VOL_3 "VP_VEHICLEPARAMETERLIBRARY_DES_VOL_3" +/** +* @~english destination vol 4 +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DES_VOL_4 "VP_VEHICLEPARAMETERLIBRARY_DES_VOL_4" +/** +* @~english destination vol 5 +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DES_VOL_5 "VP_VEHICLEPARAMETERLIBRARY_DES_VOL_5" +/** +* @~english destination vol 6 +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DES_VOL_6 "VP_VEHICLEPARAMETERLIBRARY_DES_VOL_6" +/** +* @~english destination vol 7 +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DES_VOL_7 "VP_VEHICLEPARAMETERLIBRARY_DES_VOL_7" +/** +* @~english destination vol 8 +*/ +#define VP_VEHICLEPARAMETERLIBRARY_DES_VOL_8 "VP_VEHICLEPARAMETERLIBRARY_DES_VOL_8" +/** +* @~english steering type +*/ +#define VP_VEHICLEPARAMETERLIBRARY_STEERING_TYPE "VP_VEHICLEPARAMETERLIBRARY_STEERING_TYPE" +/** +* @~english move range of handwrite mode +*/ +#define VP_VEHICLEPARAMETERLIBRARY_HANDWRITEMODE_MOVERANGE "VP_VEHICLEPARAMETERLIBRARY_Handwritemode_moverange" +/** +* @~english touchpad home show +*/ +#define VP_VEHICLEPARAMETERLIBRARY_TOUCHPAD_HOME_SW "VP_VEHICLEPARAMETERLIBRARY_TOUCHPAD_HOME_SW" +/** +* @~english BT add device switch +*/ +#define VP_VEHICLEPARAMETERLIBRARY_BT_ADD_DEVICE_SW "VP_VEHICLEPARAMETERLIBRARY_BT_ADD_DEVICE_SW" +/** +* @~english AGL URL of Product for Repro. +*/ +#define VP_AGL_REPRO_SVR_PRODUCT_URL "VP_AGL_REPRO_SVR_PRODUCT_URL" +/** +* @~english AGL URL of Try for Repro. +*/ +#define VP_AGL_REPRO_SVR_TRY_URL "VP_AGL_REPRO_SVR_TRY_URL" +/** +* @~english AGL URL of Test for Repro. +*/ +#define VP_AGL_REPRO_SVR_TEST_URL "VP_AGL_REPRO_SVR_TEST_URL" + + +#define VP_VEHICLEPARAMETERLIBRARY__CWORD70__EU "VP_VEHICLEPARAMETERLIBRARY__CWORD70__EU" +#define VP_VEHICLEPARAMETERLIBRARY__CWORD40_ "VP_VEHICLEPARAMETERLIBRARY__CWORD40_" +#define VP_VEHICLEPARAMETERLIBRARY_DCM_EC "VP_VEHICLEPARAMETERLIBRARY_DCM_EC" +#define VP_VEHICLEPARAMETERLIBRARY_EXTERNALDISPLAY_INTERACTION "VP_VEHICLEPARAMETERLIBRARY_ExternalDisplay_Interaction" +#define VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_FL_SP "VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_FL_SP" +#define VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_FR_SP "VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_FR_SP" +#define VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_RL_SP "VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_RL_SP" +#define VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_RR_SP "VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_RR_SP" +#define VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_FC_SP "VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_FC_SP" +#define VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_ML_SP "VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_ML_SP" +#define VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_MR_SP "VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_MR_SP" +#define VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_NAVI_SP "VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_NAVI_SP" +#define VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_HRDRIVER "VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_HRDriver" +#define VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_HRPASSENGER "VP_VEHICLEPARAMETERLIBRARY_DES_OUTPUT_HRPassenger" +#define VP_VEHICLEPARAMETERLIBRARY_AUTOMATED_DRIVING "VP_VEHICLEPARAMETERLIBRARY_AUTOMATED_DRIVING" +#define VP_VEHICLEPARAMETERLIBRARY_OPN_MOV "VP_VEHICLEPARAMETERLIBRARY_OPN_MOV" +#define VP_VEHICLEPARAMETERLIBRARY__CWORD84__SDSLOT "VP_VEHICLEPARAMETERLIBRARY__CWORD84__SDslot" +#define VP_VEHICLEPARAMETERLIBRARY_BTANT_TYPE "VP_VEHICLEPARAMETERLIBRARY_BTANT_TYPE" +#define VP_VEHICLEPARAMETERLIBRARY_MIC_MFR "VP_VEHICLEPARAMETERLIBRARY_MIC_MFR" + + +/** @}*/ // end of vehicle_parameter_library +/** @}*/ // end of other_service +/** @}*/ // end of BaseSystem + +#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_H_ diff --git a/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h b/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h new file mode 100644 index 00000000..8aeb048f --- /dev/null +++ b/vehicle_parameter_library/library/include/other_service/env_vehicleparameterlibrary_serial.h @@ -0,0 +1,67 @@ +/* + * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/** + * @file env_vehicleparameterlibrary_serial.h + * @brief \~english Define of Serial vehicle parameter environment variable + */ + +#ifndef VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_SERIAL_H_ +#define VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_SERIAL_H_ + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup other_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup vehicle_parameter_library + * @ingroup other_service + * @{ + */ + +/** + * \~english Enviroment variable serial + */ +#define VP_VEHICLEPARAMETERLIBRARY_SER_SERIAL "VP_VEHICLEPARAMETERLIBRARY_SER_serial" + +/** + * \~english Enviroment variable _CWORD49__ID + */ +#define VP_VEHICLEPARAMETERLIBRARY_SER__CWORD49__ID "VP_VEHICLEPARAMETERLIBRARY_SER__CWORD49__ID" +/** + * \~english Enviroment variable HELPNET_ID + */ +#define VP_VEHICLEPARAMETERLIBRARY_SER_HELPNET_ID "VP_VEHICLEPARAMETERLIBRARY_SER_HELPNET_ID" +/** + * \~english Enviroment variable map_update_ID + */ +#define VP_VEHICLEPARAMETERLIBRARY_SER_MAP_UPDATE_ID "VP_VEHICLEPARAMETERLIBRARY_SER_map_update_ID" +/** + * \~english Enviroment variable ship_date + */ +#define VP_VEHICLEPARAMETERLIBRARY_SER_SHIP_DATE "VP_VEHICLEPARAMETERLIBRARY_SER_ship_date" +/** + * \~english Enviroment variable FACTORY_ID + */ +#define VP_VEHICLEPARAMETERLIBRARY_SER_FACTORY_ID "VP_VEHICLEPARAMETERLIBRARY_SER_FACTORY_ID" + +/** @}*/ // end of vehicle_parameter_library +/** @}*/ // end of other_service +/** @}*/ // end of BaseSystem + +#endif // VEHICLE_PARAMETER_LIBRARY_LIBRARY_INCLUDE_OTHER_SERVICE_ENV_VEHICLEPARAMETERLIBRARY_SERIAL_H_ diff --git a/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h b/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h new file mode 100644 index 00000000..bf88080d --- /dev/null +++ b/vehicle_parameter_library/library/include/other_service/vehicle_parameter_library.h @@ -0,0 +1,46 @@ +/* + * @copyright Copyright (c) 2017-2019 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/** + * @file vehicle_parameter_library.h + * @brief \~english include all vehicle_parameter_library head files + */ + +#ifndef OTHERSERVICE_VEHICLEPARAMETERLIBRARY_H_ // NOLINT(build/header_guard) +#define OTHERSERVICE_VEHICLEPARAMETERLIBRARY_H_ // NOLINT(build/header_guard) + +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup other_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup vehicle_parameter_library + * @ingroup other_service + * @{ + */ +#include <other_service/VP_FuncCheck_CanRcv.h> +#include <other_service/VP_GetEnv.h> +#include <other_service/env_vehicleparameterlibrary.h> +#include <other_service/env_vehicleparameterlibrary_serial.h> +#include <other_service/env_vehicle.h> +#include <other_service/env_ext.h> +/** @}*/ // end of vehicle_parameter_library +/** @}*/ // end of other_service +/** @}*/ // end of BaseSystem + +#endif // OTHERSERVICE_VEHICLEPARAMETERLIBRARY_H_ diff --git a/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c b/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c new file mode 100644 index 00000000..5f39609b --- /dev/null +++ b/vehicle_parameter_library/library/src/VP_FuncCheck_CanRcv.c @@ -0,0 +1,728 @@ +/* + * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/** + * @file VP_FuncCheck_CanRcv.c + * @brief Get function existence API + */ + + +/* ====================================================================== */ +/* Header */ +/* ====================================================================== */ +#include <assert.h> +#include <string.h> +#include <regex.h> + +#include <other_service/VP_GetEnv.h> +#include "VP_FuncCheck_CanRcv_private.h" + +/* ====================================================================== */ +/* Enumeration types */ +/* ====================================================================== */ +typedef enum VPFuncTableDestIndexTag{ + /* + * Note. + * This feature needs to be defined by the vendor. + */ + VP_FUNC_TABLE_DEST_INDEX_A , + VP_FUNC_TABLE_DEST_INDEX_B , + + VP_FUNC_TABLE_DEST_INDEX_MAX /**< Number of choices (index maximum value: 1) */ +} VP_FUNC_TABLE_DEST_INDEX; + +typedef enum VPFuncTableBrandTag{ + /* + * Note. + * This feature needs to be defined by the vendor. + */ + VP_FUNC_TABLE_BRAND_A, + VP_FUNC_TABLE_BRAND_B, + + VP_FUNC_TABLE_BRAND_INDEX_MAX /**< Number of choices (index maximum value: 1) */ +} VP_FUNC_TABLE_BRAND; + +typedef enum VPFuncTableGradeLTag{ + /* + * Note. + * This feature needs to be defined by the vendor. + */ + VP_FUNC_TABLE_GRADE_A1, + VP_FUNC_TABLE_GRADE_A2, + + VP_FUNC_TABLE_GRADE_A_INDEX_MAX /**< Number of choices (index maximum value: 1) */ +} VP_FUNC_TABLE_GRADE_A; + +typedef enum VPFuncTableGradeTTag{ + /* + * Note. + * This feature needs to be defined by the vendor. + */ + VP_FUNC_TABLE_GRADE_B1, + VP_FUNC_TABLE_GRADE_B2, + + VP_FUNC_TABLE_GRADE_B_INDEX_MAX /**< Number of choices (index maximum value: 1) */ +} VP_FUNC_TABLE_GRADE_B; + +typedef enum VPFuncTableFuncTypeIndexTag{ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN , /**< Unknown function */ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_XM_AUDIO , /**< XM Audio */ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_VP_CANRCV__CWORD27_ , /**< _CWORD27_ */ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_HOTSPOT , /**< Wifi Hotspot */ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_RESTRICT_FUNCTION , /**< Travel Restriction */ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_HD_DATA , /**< HD Data */ + + VP_FUNC_TABLE_FUNC_TYPE_INDEX_MAX /**< Number of choices (index maximum value: 1) */ +} VP_FUNC_TABLE_FUNC_TYPE; + +/** Processing definitions for CAN information availability */ +typedef enum CANFuncCheckSwitchTag{ + CAN_FUNC_CHEK_AVAILABLE , + CAN_FUNC_CHEK_UNAVAILABLE , + CAN_FUNC_CHEK_COUNTRY_CODE +} CAN_FUNC_CHEK_SWITCH; + + + +/**< Definition of number of functions (required for initial definition of function availability table) */ + +#define VP_FUNC_TABLE_FUNCTION_INDEX_MAX ((unsigned int)6) + +/* ====================================================================== */ +/* Macro definitions */ +/* ====================================================================== */ +/* Definition for return value from string functions */ +#define RET_STD_LIB_STRING_STR_CMP_OK ((int)0) /**< The return value of the strncmp. this value is returned when matched. */ + +/* Default index values */ +#define DEFAULT_TABLE_INDEX_DEST (VP_FUNC_TABLE_DEST_INDEX_OTHER) /* Initial value changed by the specification which returns the setting of the belonging property when the undefined country code is gotten. */ +#define DEFAULT_TABLE_INDEX_BRAND (VP_FUNC_TABLE_BRAND_A) +#define DEFAULT_TABLE_INDEX_GRADE_A (VP_FUNC_TABLE_GRADE_A1) +#define DEFAULT_TABLE_INDEX_GRADE_B (VP_FUNC_TABLE_GRADE_B1) +#define DEFAULT_CAN_JUDGE_STATUS (CAN_FUNC_CHEK_COUNTRY_CODE) + +/* ====================================================================== */ +/* Constant definitions */ +/* ====================================================================== */ + +/* ====================================================================== */ +/* Structures */ +/* ====================================================================== */ + +/* ====================================================================== */ +/* Internal function prototype declarations */ +/* ====================================================================== */ +#ifdef VP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE +MT_STATIC u_int8_t getResult_CanJudge( unsigned int idx_func ); +MT_STATIC unsigned int getIndexOfFunc( u_int8_t func ); +MT_STATIC unsigned int getIndexOfTable( const char vp_param_str[] , const TABLE_INDEX_INFO table_index_info[] , unsigned int info_size, unsigned int default_index ); +MT_STATIC VP_FCCR_BOOL hasMultipleCoutnry( const char dest_str[] , const char multiple_country_code_desig[] ); +#endif +/* ====================================================================== */ +/* Public function definitions */ +/* ====================================================================== */ +/** + * @fn + * u_int8_t VP_FuncCheck_CanRcv( u_int8_t FunctionName ) + * @brief Get function existence API(Public) + * @param[in] (FunctionName) Function Name (Number) + * @return FUNCTION_CHECK_RESULT_OK :This function is available + * FUNCTION_CHECK_RESULT_NG :This function is unavailable + * FUNCTION_CHECK_RESULT_UNKNOWN :This function does not exist + * @details Read the function name as feature name specified in the argument, then return one of the + * "This function is available"/"This function is unavailable"/"This function does not exist" + * of the feature as the following check-result: + * - vehicle parameter:CAN information availability(destination package) judge + * - vehicle parameter:country code + * - Whether or not supported the features corresponding to the country code in this API + * + * When CAN information availability (destination package) in vehicle parameters is + * "Control ON/OFF according to CAN information" or "Country code", return "This function is available" + * if this function is called when the country code from CAN is unacquired or undetermined country code. + */ +/* ====================================================================== */ +u_int8_t VP_FuncCheck_CanRcv( u_int8_t FunctionName ) +{ +#ifndef VP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE + u_int8_t result; + + switch(FunctionName) { + case XM_AUDIO: + result = FUNCTION_CHECK_RESULT_NG; + break; + + case VP_CANRCV__CWORD27_: + case WIFI_HOTSPOT: + case AREA1_STD_TRAF_LIMIT: + case HD_DATA: + result = FUNCTION_CHECK_RESULT_OK; + break; + default: + result = FUNCTION_CHECK_RESULT_UNKNOWN; + break; + } + + return result; +#else + + /* ====================================================================== */ + /* Internal table definition */ + /* ====================================================================== */ + /** Vehicle Parameter "CAN information Support/Not Support"- processing selector translation table */ + const TABLE_INDEX_INFO TABLE_STATUS_INFO_CAN_JUDGE[] = + { + { "available" , CAN_FUNC_CHEK_AVAILABLE }, // Yes + { "unavailable" , CAN_FUNC_CHEK_UNAVAILABLE }, // None + { "CAN_judge" , CAN_FUNC_CHEK_COUNTRY_CODE }, // Control ON/OFF according to CAN information + { "country_ID" , CAN_FUNC_CHEK_COUNTRY_CODE } // Country code + }; + + /* ====================================================================== */ + /* Table Size Definition */ + /* ====================================================================== */ + const unsigned int LENGTHOF_TABLE_INDEX_INFO_CAN_JUDGE = ( sizeof(TABLE_STATUS_INFO_CAN_JUDGE ) / sizeof( TABLE_INDEX_INFO ) ); + + /* ====================================================================== */ + /* Internal variable declarations */ + /* ====================================================================== */ + u_int8_t result = FUNCTION_CHECK_RESULT_UNKNOWN; + + unsigned int idx_func = 0; + + unsigned int can_judge_status = CAN_FUNC_CHEK_COUNTRY_CODE; + char VP_canjudge[ VP_MAX_LENGTH ]; + char VP_area[ VP_MAX_LENGTH ]; + + /* ====================================================================== */ + /* Process */ + /* ====================================================================== */ + /* Get vehicle parameter */ + VP_GetEnv( VEHICLEPARAMETERLIBRARY_AREA , &(VP_area[0]) ); + + DEBUG_PRINTF( "AREA = %d; " , VP_area ) + + /* Get feature name index */ + idx_func = getIndexOfFunc( FunctionName ); + + DEBUG_PRINTF( "Function = %d; " , FunctionName ) + DEBUG_PRINTF( "idx_func = %d\n" , idx_func ) + + /* Judge as other than area1 because it is not a area1 */ + if ( strncmp( VP_area, "AREA1", VP_MAX_LENGTH ) != RET_STD_LIB_STRING_STR_CMP_OK ) + { + result = FUNCTION_CHECK_RESULT_OUT_OF_AREA1; + } + else + { + /* If the feature is unknown, it is judged to be unknown before checking CAN information. */ + if ( VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN == idx_func ) + { + result = FUNCTION_CHECK_RESULT_UNKNOWN; + } + else + { + /* Get vehicle parameter */ /* It is unnecessary to get the parameter every time, but because there is no process to check the change, it is gotten every time as a precaution. */ + VP_GetEnv( VP__CWORD31__TELEMATICS_FUNCTION , &(VP_canjudge[0]) ); + + /* Choose processing according to CAN information Support/Not Support. */ + can_judge_status = getIndexOfTable( + &(VP_canjudge[0]), + &(TABLE_STATUS_INFO_CAN_JUDGE[0]), + LENGTHOF_TABLE_INDEX_INFO_CAN_JUDGE, + DEFAULT_CAN_JUDGE_STATUS + ); + + DEBUG_PRINTF( "VP_canjudge = %s; ", VP_canjudge ) + + /* When judging from CAN information or country code */ + if ( CAN_FUNC_CHEK_COUNTRY_CODE == can_judge_status ) + { + DEBUG_PRINT( "CAN judge : C_CODE or CAN_JUDGE" ) + result = getResult_CanJudge( idx_func ); + } + else + { + /* For available/unavailable */ + /* Standard travel restriction of AREA1 */ + if ( AREA1_STD_TRAF_LIMIT == idx_func ) + { + result = FUNCTION_CHECK_RESULT_OK; + } + else + { + switch( can_judge_status ) + { + case CAN_FUNC_CHEK_UNAVAILABLE: + DEBUG_PRINT( "CAN judge : UNAVAILABLE" ) + result = FUNCTION_CHECK_RESULT_NG; + break; + + case CAN_FUNC_CHEK_AVAILABLE: + default: /* If the default value of canjudge_status are set correctly, the default cannot be selected */ + DEBUG_PRINT( "CAN judge : AVAILABLE" ) + result = FUNCTION_CHECK_RESULT_OK; + break; + } + } + } + } + } + DEBUG_PRINTF( "RESULT = %d\n", result ) + + return result; + +#endif +} + +/* ====================================================================== */ +/* Internal function definitions */ +/* ====================================================================== */ +#ifdef VP_FUNCCHECK_CANRCV_CANRCV_ACTIVATE +/* ====================================================================== */ +/** + * @brief Get function existence in consideration of country code + * @detials Internal-use functions - Processing when CAN information availability is "Country Code" + * @param[in] idx_func Table index corresponding to the feature (takes as its argument the value after conversion to a table index, not the feature name) + * @return Availability of the feature in current vehicle parameters + */ +/* ====================================================================== */ +MT_STATIC u_int8_t getResult_CanJudge( unsigned int idx_func ) +{ + /* ====================================================================== */ + /* Internal constant definition */ + /* ====================================================================== */ + static const char MULTIPLE_COUNTRY_CODE_DESIG[] = "^[0-9](;[0-9]);{0,1}"; /**< Regular Expression String for Multiple Countries (Attributes) */ + + /* ====================================================================== */ + /* Internal table definitions */ + /* ====================================================================== */ + /** Feature table index conversion table (country code) */ + const TABLE_INDEX_INFO TABLE_INDEX_INFO_DESTINATION[] = + { + /* + * Note. + * This feature needs to be defined by the vendor. + */ + { "101" , VP_FUNC_TABLE_DEST_INDEX_A }, // Detination A + { "102" , VP_FUNC_TABLE_DEST_INDEX_B } // Detination B + }; + + /** @todo The consideration. For the feature table by country code, if it can be summarized the GRADE A1/GRADE A2 and GRADE B1/GRADE B2, + It can be also summarized the translation table. + However, it must be able to guarantee that there are no differences in the table format in L/T. */ + /** Index Ttranslation Table for feature availability table (for grade A) */ + const TABLE_INDEX_INFO TABLE_INDEX_INFO_GRADE_A[] = + { + /* + * Note. + * This feature needs to be defined by the vendor. + */ + { "A1" , VP_FUNC_TABLE_GRADE_A1 }, // GRADE A1 + { "A2" , VP_FUNC_TABLE_GRADE_A2 } // GRADE A2 + }; + + /** Index Translation Table for feature availability table (for grade B) */ + const TABLE_INDEX_INFO TABLE_INDEX_INFO_GRADE_B[] = + { + /* + * Note. + * This feature needs to be defined by the vendor. + */ + { "B1" , VP_FUNC_TABLE_GRADE_B1 }, // GRADE B1 + { "B2" , VP_FUNC_TABLE_GRADE_B2 }, // GRADE B2 + }; + + /** Index Translation Table for feature availability table (brand) */ + const TABLE_INDEX_INFO TABLE_INDEX_INFO_BRAND[] = + { + /* + * Note. + * This feature needs to be defined by the vendor. + */ + { "A" , VP_FUNC_TABLE_BRAND_A }, // BRAND A + { "B" , VP_FUNC_TABLE_BRAND_B } // BRAND B + }; + + /* ====================================================================== */ + /** + * @brief Feature availability table for BRAND A + * @details Array of type u_int8_t accessed by the following index + */ + /* ====================================================================== */ + const u_int8_t VP_FUNC_CHECK_CANRCV_TABLE_A[ VP_FUNC_TABLE_DEST_INDEX_MAX ] + [ VP_FUNC_TABLE_GRADE_A_INDEX_MAX ] + [ VP_FUNC_TABLE_FUNCTION_INDEX_MAX ] = + { + /* + * Note. + * This feature needs to be defined by the vendor. + */ + /* Destination A */ + { + // Unknown , XM Audio , _CWORD27_ , Wifi HotSpot , Travel Restriction , HD Data + { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE A1 + { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG } // GRADE A2 + }, + + /* Destination B */ + { + { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE A1 + { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG } // GRADE A2 + } + }; + + /* ====================================================================== */ + /** + * @brief Feature availability table for BRAND B + */ + /* ====================================================================== */ + const u_int8_t VP_FUNC_CHECK_CANRCV_TABLE_B[ VP_FUNC_TABLE_DEST_INDEX_MAX ] + [ VP_FUNC_TABLE_GRADE_B_INDEX_MAX ] + [ VP_FUNC_TABLE_FUNCTION_INDEX_MAX ] = + { + /* + * Note. + * This feature needs to be defined by the vendor. + */ + /* Destination A */ + { + // Unknown , XM Audio , _CWORD27_ , Wifi HotSpot , Travel Restriction , HD Data + { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE B1 + { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG }, // GRADE B2 + }, + + /* Detination B */ + { + { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK }, // GRADE B1 + { FUNCTION_CHECK_RESULT_UNKNOWN, FUNCTION_CHECK_RESULT_NG, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_OK, FUNCTION_CHECK_RESULT_NG }, // GRADE B2 + } + }; + + /* ====================================================================== */ + /* Table Size Definitions */ + /* ====================================================================== */ + const unsigned int SIZE_TABLE_INDEX_INFO_BRAND = ( sizeof(TABLE_INDEX_INFO_BRAND ) / sizeof( TABLE_INDEX_INFO ) ); + const unsigned int SIZE_TABLE_INDEX_INFO_GRADE_A = ( sizeof(TABLE_INDEX_INFO_GRADE_A ) / sizeof( TABLE_INDEX_INFO ) ); + const unsigned int SIZE_TABLE_INDEX_INFO_GRADE_B = ( sizeof(TABLE_INDEX_INFO_GRADE_B ) / sizeof( TABLE_INDEX_INFO ) ); + const unsigned int SIZE_TABLE_INDEX_INFO_DESTINATION = ( sizeof(TABLE_INDEX_INFO_DESTINATION) / sizeof( TABLE_INDEX_INFO ) ); + + /* ====================================================================== */ + /* Variable declarations */ + /* ====================================================================== */ + u_int8_t result = FUNCTION_CHECK_RESULT_UNKNOWN; + + VP_FCCR_BOOL isMultipleCountry = B_FALSE; + + unsigned int idx_dest = 0; + unsigned int idx_brand = 0; + unsigned int idx_grade = 0; + + char VP_destination[ VP_MAX_LENGTH ]; + char VP_brand[ VP_MAX_LENGTH ]; + char VP_grade[ VP_MAX_LENGTH ]; + + /* ====================================================================== */ + /* Static assertion */ + /* ====================================================================== */ + /* The following are expected to be identical */ + VP_DEBUG_STATIC_ASSERT( SIZE_TABLE_INDEX_INFO_BRAND == VP_FUNC_TABLE_BRAND_INDEX_MAX ) + VP_DEBUG_STATIC_ASSERT( SIZE_TABLE_INDEX_INFO_GRADE_A == VP_FUNC_TABLE_GRADE_A_INDEX_MAX ) + + /* Country code does not match because there are multiple countries. */ + VP_DEBUG_STATIC_ASSERT( VP_FUNC_TABLE_DEST_INDEX_MAX > SIZE_TABLE_INDEX_INFO_DESTINATION ) + + /* ====================================================================== */ + /* Process */ + /* ====================================================================== */ + + /* Argument check */ + if ( VP_FUNC_TABLE_FUNC_TYPE_INDEX_MAX <= idx_func ) + { + DEBUG_PRINTF( "ERROR : tebale index overed idx_func = %d\n", idx_func ) + + // Return unknown if the table size is exceeded. (However, this function can be called only from the API at the moment.) + result = FUNCTION_CHECK_RESULT_UNKNOWN; + } + else + { + + /* Get vehicle parameter */ + VP_GetEnv( VP__CWORD31__DESTINATION, &(VP_destination[0]) ); + VP_GetEnv( VEHICLEPARAMETERLIBRARY_BRAND , &(VP_brand[0]) ); + VP_GetEnv( VP_VEHICLEPARAMETERLIBRARY_GRADE , &(VP_grade[0]) ); + + DEBUG_PRINTF( "VP_destination = %s\n", VP_destination ) + + /* Append NULL at the end just in case. (so as not to cause any problems using the strlen or regcomp later) */ + VP_destination[ VP_MAX_LENGTH - 1 ] = '\0'; + VP_brand[ VP_MAX_LENGTH - 1 ] = '\0'; + VP_grade[ VP_MAX_LENGTH - 1 ] = '\0'; + + /* Check if the country code is NULL */ + if ( VP_destination[0] == '\0' ) + { + /* If NULL, set the index for the country code of the US. */ + idx_dest = VP_FUNC_TABLE_DEST_INDEX_A; + DEBUG_PRINTF( "[debug]idx_dest = %d\n", idx_dest ) + } + else + { + /* Check whether it is a member (multiple countries) */ + isMultipleCountry = hasMultipleCoutnry( &(VP_destination[0]), &(MULTIPLE_COUNTRY_CODE_DESIG[0]) ); + + /* Get the index for a country code */ + if ( B_TRUE == isMultipleCountry ) + { + /* If it is dependent (multiple countries), set the index for the country code of the dependent */ + DEBUG_PRINT( "isMultipleCountry = TRUE" ) + + idx_dest = VP_FUNC_TABLE_DEST_INDEX_B; + } + else + { + /* If it is not dependent (multiple countries), it searches the translation table and sets the index. */ + DEBUG_PRINT( "isMultipleCountry = FALSE" ) + + idx_dest = getIndexOfTable( &(VP_destination[0]), &(TABLE_INDEX_INFO_DESTINATION[0]), SIZE_TABLE_INDEX_INFO_DESTINATION, DEFAULT_TABLE_INDEX_DEST ); + } + } + DEBUG_PRINTF( "idx_dest = %d\n", idx_dest ) + + /* Get brand index */ + idx_brand = getIndexOfTable( &(VP_brand[0]) , &(TABLE_INDEX_INFO_BRAND[0]) , SIZE_TABLE_INDEX_INFO_BRAND , DEFAULT_TABLE_INDEX_BRAND ); + + /* + * Get grade index + * Setting Defaults for each brand + * e.g. The default is A, so if it is not B, it is determined to be A. + */ + if ( VP_FUNC_TABLE_BRAND_B == idx_brand ) + { + DEBUG_PRINT( "idx_brand = B") + + idx_grade = getIndexOfTable( &(VP_grade[0]) , &(TABLE_INDEX_INFO_GRADE_B[0]) , SIZE_TABLE_INDEX_INFO_GRADE_B , DEFAULT_TABLE_INDEX_GRADE_B ); + + /* Table access */ + result = VP_FUNC_CHECK_CANRCV_TABLE_B[idx_dest][idx_grade][idx_func]; + + } + else + { + DEBUG_PRINT( "idx_brand = A") + + idx_grade = getIndexOfTable( &(VP_grade[0]) , &(TABLE_INDEX_INFO_GRADE_A[0]) , SIZE_TABLE_INDEX_INFO_GRADE_A , DEFAULT_TABLE_INDEX_GRADE_A ); + + /* Table access */ + result = VP_FUNC_CHECK_CANRCV_TABLE_A[idx_dest][idx_grade][idx_func]; + + } + + //DEBUG_PRINTF( "RESULT = %d\n", result ) + } + + return result; +} + + +/* ====================================================================== */ +/** + * @brief Feature-Table Index Translation Function + * @detials Internal-use functions. It is translate the feature definition number to an index for the table. + * @param[in] Feature name defined by the func define + * @return The table index corresponding to the feature. If the given country code is invalid, return the index given by default_idx + */ + /* ====================================================================== */ +MT_STATIC unsigned int getIndexOfFunc( u_int8_t func ) +{ + /* ====================================================================== */ + /* Internal table definitions */ + /* ====================================================================== */ + /** Index translation table for feature table (Features) */ + const VP_FUNC_TABLE_FUNC_TYPE GET_INDEX_OF_FUNC[] = { + VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN , //#define VP_FUNCCHECK_CANRCV_UNKNOWN ((u_int8_t)0) /* Unknown Features */ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_XM_AUDIO , //#define XM_AUDIO ((u_int8_t)1) /* XM Audio */ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_VP_CANRCV__CWORD27_ , //#define _CWORD27_ ((u_int8_t)3) /* _CWORD27_ */ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_HOTSPOT , //#define WIFI_HOTSPOT ((u_int8_t)4) /* WiFi HotSpot */ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_RESTRICT_FUNCTION , //#define AREA1_STD_TRAF_LIMIT ((u_int8_t)5) /* Standard Travel Restriction of AREA1 */ + VP_FUNC_TABLE_FUNC_TYPE_INDEX_HD_DATA //#define HD_DATA ((u_int8_t)6) /* HD Data (Include traffic) */ + + }; + + + /* ====================================================================== */ + /* Variable declarations */ + /* ====================================================================== */ + const unsigned int index_table_size = sizeof( GET_INDEX_OF_FUNC ) / sizeof( VP_FUNC_TABLE_FUNC_TYPE ); + + u_int8_t table_index = VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN; + + /* ====================================================================== */ + /* Static assertions */ + /* ====================================================================== */ + /* In the current configuration, the feature's defined value and index match, so the translation table size should also match (remove this assertion if there is no match) */ + VP_DEBUG_STATIC_ASSERT( index_table_size == VP_FUNC_TABLE_FUNCTION_INDEX_MAX ) + + /* Translation tables or the enumeration pair (VP_FUNC_TABLE_FUNC_TYPE) must also be modified when the definition value changes. + It may also be changed, added, or deleted following asserts as appropriate according to the defined value. */ + VP_DEBUG_STATIC_ASSERT( XM_AUDIO == VP_FUNC_TABLE_FUNC_TYPE_INDEX_XM_AUDIO ) + + VP_DEBUG_STATIC_ASSERT( VP_CANRCV__CWORD27_ == VP_FUNC_TABLE_FUNC_TYPE_INDEX_VP_CANRCV__CWORD27_ ) + VP_DEBUG_STATIC_ASSERT( WIFI_HOTSPOT == VP_FUNC_TABLE_FUNC_TYPE_INDEX_WIFI_HOTSPOT ) + VP_DEBUG_STATIC_ASSERT( AREA1_STD_TRAF_LIMIT == VP_FUNC_TABLE_FUNC_TYPE_INDEX_RESTRICT_FUNCTION ) + VP_DEBUG_STATIC_ASSERT( HD_DATA == VP_FUNC_TABLE_FUNC_TYPE_INDEX_HD_DATA ) + + + /* ====================================================================== */ + /* Process */ + /* ====================================================================== */ + + /* Argument check: Treat as unknown feature if it is larger than index translation table */ + if ( index_table_size <= func ) + { + table_index = VP_FUNC_TABLE_FUNC_TYPE_INDEX_UNKNOWN; + } + else + { + table_index = (u_int8_t)(GET_INDEX_OF_FUNC[func]); + } + + return table_index; + +} + +/* ====================================================================== */ +/** + * @brief Vehicle parameter string to integer conversion function + * @detials Internal-use function. Convert the given string (vehicle parameter) into an index for the table. + * The value gotten using VP_GetEnv() is assumed. Thus, the maximum length is VP_MAX_LENGTH. + * Return the value set in default_index if the conversion is failed. + * @param[in] vp_param_str String as source of convetion to the table index + * @param[in] table_index_info String corresponding to table index and an array of structs with table indexes set + * @param[in] info_size Size of the table_index_info array + * @param[in] default_index Default index. Return this value if none of table_index_info matches + * @return The table index corresponding to the vehicle parameter string given by the argument. Return the value given by the default_index argument if the given country code is invalid. + */ + /* ====================================================================== */ +MT_STATIC unsigned int getIndexOfTable( const char vp_param_str[], const TABLE_INDEX_INFO table_index_info[], unsigned int info_size, unsigned int default_index ) +{ + unsigned int table_index = 0; + + table_index = default_index; /* Set as initial value so that it can return the set default if it is unknown */ + + //DEBUG_PRINTF("info_size = %d\n", info_size) + + /* NULL checking */ + if ( NULL != vp_param_str ) + { + if ( NULL != table_index_info ) + { + unsigned int i = 0; + + for ( i = 0; i < info_size; i++ ) + { + if ( RET_STD_LIB_STRING_STR_CMP_OK == strncmp( &(vp_param_str[0]), &((table_index_info[i]).code_str[0]), VP_MAX_LENGTH ) ) + { + table_index = (table_index_info[i]).index; + + break; + } + } + } + else + { + DEBUG_PRINT( "ERROR!! the Bad Teble overd." ) + } + } + + return table_index; +} + +/* ====================================================================== */ +/** + * @brief Function to check whether country code is multiple countries or not + * @detials Internal-use functions. Check if the country code given in the argument contains more than one country. + * The determination whether multiple country code or not shall be true if it exactly matches the specified + * regular expression which is a characteristic of multiple countries. + * The exact match determination shall be the exact match if the length of the matched character matches + * the length of the character passed in the argument. + * @param[in] dest_str Country code string. The value gotten using VP_GetEnv() is assumed. Therefore, the maximum length is VP_MAX_LENGTH. + * @param[in] multiple_country_code_desig String for determining multiple country codes. Regular expression strings if a regular expression library is used. Otherwise, a single-character string representing the delimiter. + * If it gets trapped inside a function, it will have to stub the regcomp during function unit tests, which is very cumbersome and can be removed as arguments. + * @return True if country code indicates multiple countries, otherwise false + */ +/* ====================================================================== */ +MT_STATIC VP_FCCR_BOOL hasMultipleCoutnry( const char dest_str[], const char multiple_country_code_desig[] ) +{ + /* ====================================================================== */ + /* Variable declarations */ + /* ====================================================================== */ + VP_FCCR_BOOL isMultiple = B_FALSE; + + /* ====================================================================== */ + /* Processing */ + /* ====================================================================== */ + + /* NULL checking for arguments */ + if ( ( NULL != dest_str ) && ( NULL != multiple_country_code_desig ) ) + { + regex_t preg; + + if ( 0 == regcomp( &preg, multiple_country_code_desig, REG_EXTENDED ) ) + { + regmatch_t pmatch = { 0, 0 }; + + if ( REG_NOMATCH != regexec( &preg, &(dest_str[0]), 1, &pmatch, 0) ) + { + /** @note Exactly match is considered if the end-of-match offset matches the string length. + * Assumed that it should not be used as the end-of-line character so that "$" is not included in the C base character set. + */ + if ( (strnlen( dest_str, VP_MAX_LENGTH ) == (unsigned int)(pmatch.rm_eo) ) ) + { + isMultiple = B_TRUE; + } + else + { + isMultiple = B_FALSE; + } + + DEBUG_PRINT( "FOUND" ) + } + else + { + isMultiple = B_FALSE; + + DEBUG_PRINT( "NOT FOUND" ) + } + + regfree( &preg ); + } + else + { + /* In the case of a library error, + * return false so that the default value that is set by high layer works. + */ + + /** @todo Should output using FRAMEWORKUNIFIEDLOG for library errors? */ + isMultiple = B_FALSE; + + DEBUG_PRINT( "FOUND" ) + } + } + + return isMultiple; + +} +#endif diff --git a/vehicle_parameter_library/library/src/VP_GetEnv.c b/vehicle_parameter_library/library/src/VP_GetEnv.c new file mode 100644 index 00000000..54652501 --- /dev/null +++ b/vehicle_parameter_library/library/src/VP_GetEnv.c @@ -0,0 +1,64 @@ +/* + * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/* ====================================================================== */ +/** + * @file VP_GetEnv.c + * @brief API to get vehicle parameter environment variable + */ +/* ====================================================================== */ + + +#include <stdlib.h> +#include <string.h> +#include <other_service/VP_GetEnv.h> + +/* ====================================================================== */ +/** + * @fn + * void VP_GetEnv(char *pEnvStr, char *pEnvBuff ) + * @breaf Get Environment Variable + * @param[in] (pEnvStr) Pointer to the string of the environment variable name to be gotten + * @param[out] (pEnvBuff) Start address of the area to store the gotten value of the environment variable + * @return None + * @detail Read the value (string) of the environment variable specified by the argument and stores it in the specified address. + */ +/* ====================================================================== */ +void VP_GetEnv(const char *pEnvStr, char *pEnvBuff ) +{ + char *env_string; + size_t length; + + if ((pEnvStr != NULL) && (pEnvBuff != NULL)) { + env_string = getenv(pEnvStr); + + if (env_string == NULL) { + *pEnvBuff = '\0'; + } else { + length = strlen( env_string ); + if (length < VP_MAX_LENGTH) { + (void)strcpy(pEnvBuff, env_string); + } else { + (void)strncpy(pEnvBuff, env_string, (VP_MAX_LENGTH - 1)); + pEnvBuff[ VP_MAX_LENGTH - 1 ] = '\0'; + } + } + } else { + if(pEnvBuff != NULL) { + *pEnvBuff = '\0'; + } + } +} |