diff options
author | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2020-11-20 23:17:04 +0900 |
---|---|---|
committer | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2020-11-20 23:17:04 +0900 |
commit | 9e86046cdb356913ae026f616e5bf17f6f238aa5 (patch) | |
tree | 1bfe1ff416fcd3951dc41828d43f1a397944ec6a /video_in_hal/peripheralservice | |
parent | 2219d0168f8f8418aee784a7542388ef064fa833 (diff) |
Remove unused directories and files in video_in_hal
The directory video_in_hal contained a lot of unnecessary
directories and files which supposed to have been accidentally
copied from staging/toyota.git druing migration.
Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
Change-Id: I12f2d72562bc008080ae866831d966c0b751914c
Diffstat (limited to 'video_in_hal/peripheralservice')
37 files changed, 0 insertions, 4869 deletions
diff --git a/video_in_hal/peripheralservice/.gitattributes b/video_in_hal/peripheralservice/.gitattributes deleted file mode 100755 index 445b3c2..0000000 --- a/video_in_hal/peripheralservice/.gitattributes +++ /dev/null @@ -1,128 +0,0 @@ -*.doc filter=lfs diff=lfs merge=lfs -text -*.docx filter=lfs diff=lfs merge=lfs -text -*.pdf filter=lfs diff=lfs merge=lfs -text -*.ppt filter=lfs diff=lfs merge=lfs -text -*.pptx filter=lfs diff=lfs merge=lfs -text -*.vsd filter=lfs diff=lfs merge=lfs -text -*.xls filter=lfs diff=lfs merge=lfs -text -*.xlsm filter=lfs diff=lfs merge=lfs -text -*.xlsx filter=lfs diff=lfs merge=lfs -text -*.doC filter=lfs diff=lfs merge=lfs -text -*.dOc filter=lfs diff=lfs merge=lfs -text -*.dOC filter=lfs diff=lfs merge=lfs -text -*.Doc filter=lfs diff=lfs merge=lfs -text -*.DoC filter=lfs diff=lfs merge=lfs -text -*.DOc filter=lfs diff=lfs merge=lfs -text -*.DOC filter=lfs diff=lfs merge=lfs -text -*.docX filter=lfs diff=lfs merge=lfs -text -*.doCx filter=lfs diff=lfs merge=lfs -text -*.doCX filter=lfs diff=lfs merge=lfs -text -*.dOcx filter=lfs diff=lfs merge=lfs -text -*.dOcX filter=lfs diff=lfs merge=lfs -text -*.dOCx filter=lfs diff=lfs merge=lfs -text -*.dOCX filter=lfs diff=lfs merge=lfs -text -*.Docx filter=lfs diff=lfs merge=lfs -text -*.DocX filter=lfs diff=lfs merge=lfs -text -*.DoCx filter=lfs diff=lfs merge=lfs -text -*.DoCX filter=lfs diff=lfs merge=lfs -text -*.DOcx filter=lfs diff=lfs merge=lfs -text -*.DOcX filter=lfs diff=lfs merge=lfs -text -*.DOCx filter=lfs diff=lfs merge=lfs -text -*.DOCX filter=lfs diff=lfs merge=lfs -text -*.pdF filter=lfs diff=lfs merge=lfs -text -*.pDf filter=lfs diff=lfs merge=lfs -text -*.pDF filter=lfs diff=lfs merge=lfs -text -*.Pdf filter=lfs diff=lfs merge=lfs -text -*.PdF filter=lfs diff=lfs merge=lfs -text -*.PDf filter=lfs diff=lfs merge=lfs -text -*.PDF filter=lfs diff=lfs merge=lfs -text -*.ppT filter=lfs diff=lfs merge=lfs -text -*.pPt filter=lfs diff=lfs merge=lfs -text -*.pPT filter=lfs diff=lfs merge=lfs -text -*.Ppt filter=lfs diff=lfs merge=lfs -text -*.PpT filter=lfs diff=lfs merge=lfs -text -*.PPt filter=lfs diff=lfs merge=lfs -text -*.PPT filter=lfs diff=lfs merge=lfs -text -*.pptX filter=lfs diff=lfs merge=lfs -text -*.ppTx filter=lfs diff=lfs merge=lfs -text -*.ppTX filter=lfs diff=lfs merge=lfs -text -*.pPtx filter=lfs diff=lfs merge=lfs -text -*.pPtX filter=lfs diff=lfs merge=lfs -text -*.pPTx filter=lfs diff=lfs merge=lfs -text -*.pPTX filter=lfs diff=lfs merge=lfs -text -*.Pptx filter=lfs diff=lfs merge=lfs -text -*.PptX filter=lfs diff=lfs merge=lfs -text -*.PpTx filter=lfs diff=lfs merge=lfs -text -*.PpTX filter=lfs diff=lfs merge=lfs -text -*.PPtx filter=lfs diff=lfs merge=lfs -text -*.PPtX filter=lfs diff=lfs merge=lfs -text -*.PPTx filter=lfs diff=lfs merge=lfs -text -*.PPTX filter=lfs diff=lfs merge=lfs -text -*.vsD filter=lfs diff=lfs merge=lfs -text -*.vSd filter=lfs diff=lfs merge=lfs -text -*.vSD filter=lfs diff=lfs merge=lfs -text -*.Vsd filter=lfs diff=lfs merge=lfs -text -*.VsD filter=lfs diff=lfs merge=lfs -text -*.VSd filter=lfs diff=lfs merge=lfs -text -*.VSD filter=lfs diff=lfs merge=lfs -text -*.xlS filter=lfs diff=lfs merge=lfs -text -*.xLs filter=lfs diff=lfs merge=lfs -text -*.xLS filter=lfs diff=lfs merge=lfs -text -*.Xls filter=lfs diff=lfs merge=lfs -text -*.XlS filter=lfs diff=lfs merge=lfs -text -*.XLs filter=lfs diff=lfs merge=lfs -text -*.XLS filter=lfs diff=lfs merge=lfs -text -*.xlsM filter=lfs diff=lfs merge=lfs -text -*.xlSm filter=lfs diff=lfs merge=lfs -text -*.xlSM filter=lfs diff=lfs merge=lfs -text -*.xLsm filter=lfs diff=lfs merge=lfs -text -*.xLsM filter=lfs diff=lfs merge=lfs -text -*.xLSm filter=lfs diff=lfs merge=lfs -text -*.xLSM filter=lfs diff=lfs merge=lfs -text -*.Xlsm filter=lfs diff=lfs merge=lfs -text -*.XlsM filter=lfs diff=lfs merge=lfs -text -*.XlSm filter=lfs diff=lfs merge=lfs -text -*.XlSM filter=lfs diff=lfs merge=lfs -text -*.XLsm filter=lfs diff=lfs merge=lfs -text -*.XLsM filter=lfs diff=lfs merge=lfs -text -*.XLSm filter=lfs diff=lfs merge=lfs -text -*.XLSM filter=lfs diff=lfs merge=lfs -text -*.xlsX filter=lfs diff=lfs merge=lfs -text -*.xlSx filter=lfs diff=lfs merge=lfs -text -*.xlSX filter=lfs diff=lfs merge=lfs -text -*.xLsx filter=lfs diff=lfs merge=lfs -text -*.xLsX filter=lfs diff=lfs merge=lfs -text -*.xLSx filter=lfs diff=lfs merge=lfs -text -*.xLSX filter=lfs diff=lfs merge=lfs -text -*.Xlsx filter=lfs diff=lfs merge=lfs -text -*.XlsX filter=lfs diff=lfs merge=lfs -text -*.XlSx filter=lfs diff=lfs merge=lfs -text -*.XlSX filter=lfs diff=lfs merge=lfs -text -*.XLsx filter=lfs diff=lfs merge=lfs -text -*.XLsX filter=lfs diff=lfs merge=lfs -text -*.XLSx filter=lfs diff=lfs merge=lfs -text -*.XLSX filter=lfs diff=lfs merge=lfs -text -*.json filter=lfs diff=lfs merge=lfs -text -*.jsoN filter=lfs diff=lfs merge=lfs -text -*.jsOn filter=lfs diff=lfs merge=lfs -text -*.jsON filter=lfs diff=lfs merge=lfs -text -*.jSon filter=lfs diff=lfs merge=lfs -text -*.jSoN filter=lfs diff=lfs merge=lfs -text -*.jSOn filter=lfs diff=lfs merge=lfs -text -*.jSON filter=lfs diff=lfs merge=lfs -text -*.Json filter=lfs diff=lfs merge=lfs -text -*.JsoN filter=lfs diff=lfs merge=lfs -text -*.JsOn filter=lfs diff=lfs merge=lfs -text -*.JsON filter=lfs diff=lfs merge=lfs -text -*.JSon filter=lfs diff=lfs merge=lfs -text -*.JSoN filter=lfs diff=lfs merge=lfs -text -*.JSOn filter=lfs diff=lfs merge=lfs -text -*.JSON filter=lfs diff=lfs merge=lfs -text -*.ods filter=lfs diff=lfs merge=lfs -text -*.odS filter=lfs diff=lfs merge=lfs -text -*.oDs filter=lfs diff=lfs merge=lfs -text -*.oDS filter=lfs diff=lfs merge=lfs -text -*.Ods filter=lfs diff=lfs merge=lfs -text -*.OdS filter=lfs diff=lfs merge=lfs -text -*.ODs filter=lfs diff=lfs merge=lfs -text -*.ODS filter=lfs diff=lfs merge=lfs -text diff --git a/video_in_hal/peripheralservice/communication/LICENSE b/video_in_hal/peripheralservice/communication/LICENSE deleted file mode 100755 index f433b1a..0000000 --- a/video_in_hal/peripheralservice/communication/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/video_in_hal/peripheralservice/communication/Makefile.client b/video_in_hal/peripheralservice/communication/Makefile.client deleted file mode 100755 index 8d25486..0000000 --- a/video_in_hal/peripheralservice/communication/Makefile.client +++ /dev/null @@ -1,18 +0,0 @@ -# -# @copyright Copyright (c) 2016-2020 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. -# -SUBDIRS = client_can - -include ../peripheral_service.mk diff --git a/video_in_hal/peripheralservice/communication/Makefile.server b/video_in_hal/peripheralservice/communication/Makefile.server deleted file mode 100755 index 6ebcc1a..0000000 --- a/video_in_hal/peripheralservice/communication/Makefile.server +++ /dev/null @@ -1,18 +0,0 @@ -# -# @copyright Copyright (c) 2016-2020 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. -# -SUBDIRS = server - -include ../peripheral_service.mk diff --git a/video_in_hal/peripheralservice/communication/client_can/Makefile b/video_in_hal/peripheralservice/communication/client_can/Makefile deleted file mode 100755 index 49d5708..0000000 --- a/video_in_hal/peripheralservice/communication/client_can/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# -# @copyright Copyright (c) 2016-2020 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. -# - -######### installed program ############# -#INST_PROGS = - -######### installed library(*.a) ############# -#INST_LIBS = - -######### installed shared library(*.so) ############# -INST_SHLIBS = libCAN_API - -######### install unit representative headers(*.h) ############# -VPATH += ../server/include/$(COMPONENT_NAME) -INST_HEADERS += communication_notifications.h communication.h ps_services.h - -######### install headers(*.h) ############# -VPATH += ./include/$(COMPONENT_NAME) -INST_HEADERS += Canif_API.h communication_can.h - -######### compiled sources ############# -libCAN_API_SRCS += Canif_API.cpp - -######### add source path ############# -VPATH += ./src - -######### add include path ############# -CPPFLAGS += -I./include -CPPFLAGS += -I./../client_lan/include/ -CPPFLAGS += -I./../server/include -CPPFLAGS += -I./../server/include/private -CPPFLAGS += -I./../server/include/CAN/TxMsg -CPPFLAGS += -I./../server/include/CAN/main -CPPFLAGS += -I./../server/include/main -CPPFLAGS += -I./../server/include/threads - -######### add compile option ############# -CPPFLAGS += -DLINUX -fPIC -fdata-sections -ffunction-sections -DFLG_CORE - -CPPFLAGS += -Werror=implicit-function-declaration -CPPFLAGS += -Werror=format-security - -CPPFLAGS += -Wconversion -CPPFLAGS += -Wint-to-pointer-cast -CPPFLAGS += -Wpointer-arith -CPPFLAGS += -Wformat - -######### add library path ############# -LDFLAGS += -Wl,-M -Wl,--gc-sections -LDFLAGS += -Wl,--no-as-needed -LDFLAGS += -Wl,--no-undefined - -######### linked library (static) ############# - -######### linked library (dynamic) ############# -LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified -LDLIBS += -Wl,-Bdynamic -lrt - -include ../../peripheral_service.mk diff --git a/video_in_hal/peripheralservice/communication/client_can/include/API_Local_Common.h b/video_in_hal/peripheralservice/communication/client_can/include/API_Local_Common.h deleted file mode 100755 index c5e3f78..0000000 --- a/video_in_hal/peripheralservice/communication/client_can/include/API_Local_Common.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_API_LOCAL_COMMON_H_ -#define COMMUNICATION_CLIENT_CAN_INCLUDE_API_LOCAL_COMMON_H_ -#include <string.h> -enum CANIF_PROTOCOL_IDX { - CANIF_CAN = 0, - NUM_OF_CANIF_PROTOCOL -}; - -static inline const char *Canif_PidxTosname(enum CANIF_PROTOCOL_IDX idx) { - switch (idx) { - case CANIF_CAN: - return LAN_SERVICE_CAN; - break; - default: - return "Unknown"; - break; - } -} - -#define CANIF_NOTIFY_NAME_MAX_SIZE 15 -static inline bool Canif_CheckNotifyName(PCSTR notify_name) { - size_t n = CANIF_NOTIFY_NAME_MAX_SIZE + 1; - - if (!notify_name) - return false; - - return (strnlen(notify_name, n) < n); -} - -static inline bool Canif_CheckNotifyNameWithoutNullCheck(PCSTR notify_name) { - size_t n = CANIF_NOTIFY_NAME_MAX_SIZE + 1; - return (strnlen(notify_name, n) < n); -} - -static inline void Canif_CopyNotifyName(char *dest, PCSTR notify_name) { - strncpy(dest, notify_name, - strnlen(notify_name, CANIF_NOTIFY_NAME_MAX_SIZE)); -} -#endif diff --git a/video_in_hal/peripheralservice/communication/client_can/include/Canif_API_Local.h b/video_in_hal/peripheralservice/communication/client_can/include/Canif_API_Local.h deleted file mode 100755 index d17fcc5..0000000 --- a/video_in_hal/peripheralservice/communication/client_can/include/Canif_API_Local.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_ -#define COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_ - -#define CAN_ID_MASK_CODE 0xE0000000UL // CAN ID Mask Codes -static inline bool Canif_CheckCanID(CANID id) { - if (id == 0) - return false; - - // upper 3 bit from MSB should be 0x0 - if ((CAN_ID_MASK_CODE & id) != 0x0) - return false; - - return true; -} - -static inline bool Canif_IsCommand(uint32_t cmd_id) { - switch (cmd_id) { - case CAN_CMDID_FUELCALC_RST_REQ_DELIVERY: - case CAN_CMDID_STARTUP_FIN_REQ_TX: - case CAN_CMDID_MRST_INFO_REQ_TX: - case CAN_CMDID_VERSION_REQ_TX: - case CAN_CMDID_CONNECTION_NODE_REQ_TX: - case CAN_CMDID_FUELCALC_REQ_TX: - return true; - default: - return false; - } -} - -#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_API_LOCAL_H_ diff --git a/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData.h b/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData.h deleted file mode 100755 index e9f82ac..0000000 --- a/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * @copyright Copyright (c) 2020 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. - */ - -#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_TRANSMISSIONDATA_H_ -#define COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_TRANSMISSIONDATA_H_ - -#define LAN_TYPE_21PF "CAN_21PF" - -typedef struct { - uint8_t dlc; - CAN_DATA_BIT dat; -} CAN_TRANS_START_TABLE_VAL; - -typedef struct { - CANID canid; - CAN_TRANS_START_TABLE_VAL val; -} CAN_INIT_TABLE; - -#include "Canif_TransmissionData21PF.h" - -static inline bool Canif_InitDataIsDefined21PF(CANID id) { - int32_t count; - int i; - - count = sizeof(Can_TransInitData_21PF) / - sizeof(Can_TransInitData_21PF[0]); - for (i = 0; i < count; i++) { - if (id == Can_TransInitData_21PF[i].canid) - return true; - } - - return false; -} - -#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_CANIF_TRANSMISSIONDATA_H_ diff --git a/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData21PF.h b/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData21PF.h deleted file mode 100755 index e608ca5..0000000 --- a/video_in_hal/peripheralservice/communication/client_can/include/Canif_TransmissionData21PF.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * @copyright Copyright (c) 2020 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. - */ - -// Following table could not be const because server will use this as R/W. -static CAN_INIT_TABLE Can_TransInitData_21PF[] __attribute__((unused)) = -{ - /* - * Note. - * This feature needs to be defined by the vendor. - */ - { 0x0000, 1, { 0x00 } }, - { 0x0001, 1, { 0x00 } }, - { 0x0002, 8, { 0x00 } }, - { 0x0100, 1, { 0x00 } }, - { 0x0101, 8, { 0x00 } }, - { 0x0102, 8, { 0x00 } } -}; diff --git a/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/Canif_API.h b/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/Canif_API.h deleted file mode 100755 index a68783c..0000000 --- a/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/Canif_API.h +++ /dev/null @@ -1,1158 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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 Canif_API.h - * TITLE :Data header files needed to use the CAN I/F API - ****************************************************************************/ - -#ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_ -#define COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_ - -/** - * @file Canif_API.h - * @~english - * @brief Canif API header - */ - -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup peripheral_service - * @ingroup BaseSystem - * @{ - */ -/** @addtogroup communication - * @ingroup peripheral_service - * @{ - */ -/** @addtogroup CAN - * @ingroup communication - * @{ - */ - -#include <native_service/frameworkunified_types.h> -#include <stdio.h> -#include <unistd.h> -#include <asm/unistd.h> -#include <stub/com_message_header.h> - -/** - * \~english Defination of Service name - */ -#define LAN_SERVICE_CAN "CAN_COM_PROT" - -/** - * \~english Availability notification of CAN - */ -#define NTFY_Communication_CAN_ISAVAILABLE "Communication/CanIsAvailable" - -/********************************************************************* -* Defining Return Values -***********************************************************************/ -/* Normal system */ -/** - * \~english Suceess - */ -#define CANIF_RET_NORMAL 1 -/* Abnormal system */ -/** - * \~english Parameter error - */ -#define CANIF_RET_ERROR_PARAM 2 -/** - * \~english Buffer Full - */ -#define CANIF_RET_ERROR_BUFFULL 3 -/** - * \~english CAN ID FULL - */ -#define CANIF_RET_ERROR_CANIDFULL 4 -/** - * \~english ID unregister - */ -#define CANIF_RET_ERROR_UNDEF 5 -/** - * \~english Thread ID unmatched - */ -#define CANIF_RET_ERROR_PID 6 -/** - * \~english Timer error - */ -#define CANIF_RET_ERROR_TIMER 7 -/** - * \~english Event Creat Error - */ -#define CANIF_RET_ERROR_CREATE_EVENT 8 -/** - * \~english Error Cancel - */ -#define CANIF_RET_ERROR_CANCEL 9 -/** - * \~english Null Pointer - */ -#define CANIF_RET_ERROR_NULL 10 - -/** - * \~english Flags for specifiy Delivery is echoback or not. - */ -enum CanIfEchoBackFlags { - /** - * \~english Delivery is recv data - */ - CANIF_PURERECV = 0, - /** - * \~english Delivery is echo data - */ - CANIF_ECHOBACK = 1 -}; - -/** - * \~english Defination of Command ID ( CAN -> user ) - */ -typedef enum _PS_CommunicationProtocol { - /** - * \~english Delivery CAN Data - */ - CID_CAN_DATA_DELIVERY = 0x0401, - /** - * \~english CAN communication stop - */ - CID_CAN_COMM_STOP, - /** - * \~english CAN communication restore - */ - CID_CAN_COMM_RESTORE, - /** - * \~english CAN transmission result - */ - CID_CAN_TX_RESULT, - /** - * \~english Delivery CAN command - */ - CID_CAN_CMD_DELIVERY, - /** - * \~english CAN command transmission result - */ - CID_CAN_CMD_TX_RESULT, - /** - * \~english Delivery CAN data to CANGW - */ - CID_CAN_CANGW_DELIVERY, -} PS_CommunicationProtocol; - -/** - * \~english Defination of Command ID ( CANIF -> CAN ) - */ -typedef enum _PS_Communication_InternalProtocol { - /** - * \~english Delivery registration of CAN data - */ - CID_CANIF_DELIVERY_ENTRY = 0x0501, - /** - * \~english Delivery deregistration of CAN data - */ - CID_CANIF_DELIVERY_ERASE, - /** - * \~english CAN data transmission start - */ - CID_CANIF_TX_START, - /** - * \~english CAN data communication stop watching - */ - CID_CANIF_COMM_WATCH, - /** - * \~english CAN command control - */ - CID_CANIF_CMD_CTRL, - /** - * \~english CAN data transmission start - */ - CID_CANIF_TX_BIT_START, -} PS_Communication_InternalProtocol; - -/********************************************************************* -* Definitions of CAN command IDs -***********************************************************************/ -/** -* \~english Request CAN fuel calculator reset -*/ -#define CAN_CMDID_FUELCALC_RST_REQ_DELIVERY 0x00 -/** -* \~english Request CAN startup finished notification -*/ -#define CAN_CMDID_STARTUP_FIN_REQ_TX 0x01 -/** -* \~english Request CAN Master reset notification -*/ -#define CAN_CMDID_MRST_INFO_REQ_TX 0x02 -/** -* \~english Request CAN version -*/ -#define CAN_CMDID_VERSION_REQ_TX 0x03 -/** -* \~english Request CAN connected node notification -*/ -#define CAN_CMDID_CONNECTION_NODE_REQ_TX 0x04 -/** -* \~english Request CAN BUS status notification -* ToDo@Bus error I/F is not required when CanGetBusStatus() is deleted, so it is scheduled to be deleted. -*/ -#define CAN_CMDID_BUS_STATUS_REQ_TX 0x05 -/** -* \~english Response of CAN fuel calculator reset -*/ -#define CAN_CMDID_FUELCALC_REQ_TX 0x06 -/** -* \~english Receive CAN fuel calculator reset request -*/ -#define CAN_CMDID_FUELCALC_RST_REQ_RX 0x07 -/** -* \~english Receive CAN startup finished notification -*/ -#define CAN_CMDID_STARTUP_FIN_RESP_RX 0x08 -/** -* \~english Receive CAN Master reset notification -*/ -#define CAN_CMDID_MRST_INFO_RESP_RX 0x09 -/** -* \~english Response of CAN version receive -*/ -#define CAN_CMDID_VERSION_RESP_RX 0x0A -/** -* \~english Response of CAN connection node receive -*/ -#define CAN_CMDID_CONNECTION_NODE_RESP_RX 0x0B -/** -* \~english Response of CAN bus status receive -* ToDo@Bus error I/F is not required when CanGetBusStatus() is deleted, so it is scheduled to be deleted. -*/ -#define CAN_CMDID_BUS_STATUS_RESP_RX 0x0C - -/********************************************************************* -* Control Flag/Status Definition -***********************************************************************/ -/* CANData Delivery control flag */ -/** -* \~english Delivery stop -*/ -#define CAN_DELIVERY_STOP 0 -/** -* \~english Delivery restart -*/ -#define CAN_DELIVARY_RESTART 1 - -/* CANData Transmission result notification status */ -/** -* \~english Success -*/ -#define CAN_SUCCESS 0 -/** -* \~english Retryout -*/ -#define CAN_RETRYOUT 1 -/** -* \~english Send buffer full -*/ -#define CAN_BUFFERFUL 2 - -/* IG linkage type */ -/** -* \~english IG cooperation off -*/ -#define CAN_IG_COOPERATION_OFF 0 -/** -* \~english IG cooperation on -*/ -#define CAN_IG_COOPERATION_ON 1 - -/* N_TA */ -/** -* \~english Invalid target address -*/ -#define CAN_NTA_INVALID 0xFF - -/* Others */ -/** -* \~english The code of resource ID which is not used -*/ -#define CAN_RID_NOTUSE_CODE 0xFF - -/********************************************************************* -* Data size definition -***********************************************************************/ -/** -* \~english MAX CAN data size used to send/receive message -*/ -#define CAN_DATA_SIZE 63 -/** -* \~english MAX CAN data size used to send message -*/ -#define CAN_TXDATA_SIZE 8 - -/* Data size relationship */ -/** -* \~english MAX number of delivery entry -* \~english ((528-16)-12)/4 = 125 12:event ID etc. , 4:size of CAN ID -*/ -#define CAN_DELIVERY_CANID_ENTRY_MAX 125 - -/** -* \~english OPC MAX number of delivery entry -*/ -#define CAN_DELIVERY_OPC_ENTRY_MAX 255 - -/* Message size relationship */ -/** -* \~english MAX size of message buffer -*/ -#define CAN_MSGBUF_MAX_SIZE 528 -/** -* \~english Size of message buffer header -*/ -#define CAN_MSGBUF_HEADER_SIZE 16 -/** -* \~english MAX size of message buffer header -*/ -#define CAN_MSGBUF_DATAMAX_SIZE (CAN_MSGBUF_MAX_SIZE - CAN_MSGBUF_HEADER_SIZE) - -/** -* \~english MAX size of CAN command data -*/ -#define CANCMD_DAT_MAX 68 - -/** -* \~english MAX number of CANGW transmission data -*/ -#define CANGW_SND_NUM_MAX 0x16 -/** -* \~english MAX length of CANGW DLC -*/ -#define CANGW_DLC_MAX_SIZE 0x08 - -/********************************************************************* -* Type definition -***********************************************************************/ -/** -* \~english CAN I/F API return code -*/ -typedef int32_t CANIF_RET_API; -/** -* \~english define of CAN ID type -*/ -typedef uint32_t CANID; - -/** -* \~english data ID -*/ -typedef uint32_t DID; - -/** -* \~english Data struct used to transfer CAN data -* \~english (transfer data from CAN to user) -*/ -typedef struct { - /** - * \~english CAN ID - */ - CANID can_id; - /** - * \~english Data Length - */ - uint8_t dlc; - /** - * \~english reserve - */ - uint8_t reserve[3]; - /** - * \~english DATA[0] ~ DATA[N] - */ - uint8_t data[CAN_DATA_SIZE]; - /** - * \~english reserve - */ - uint8_t reserve2; -} CAN_MSG_CANDATA_DAT; - -/** -* \~english Data struct used to transfer CAN message -* \~english (transfer message from CAN to user) -*/ -typedef struct { - /** - * \~english header - */ - T_APIMSG_MSGBUF_HEADER_COMM hdr; - /** - * \~english data - */ - CAN_MSG_CANDATA_DAT data; - /** - * \~english echoback flag - */ - enum CanIfEchoBackFlags echoback; -} CAN_MSG_CANDATA; - -/** -* \~english Data struct used to transfer CAN data to CANGW -* \~english (transfer data from CAN to user) -*/ -typedef struct { - /** - * \~english CAN ID (upper byte) - */ - uint8_t can_id_high; - /** - * \~english CAN ID (lower byte) - */ - uint8_t can_id_low; - /** - * \~english Data Length - */ - uint8_t dlc; - /** - * \~english data - */ - uint8_t data[CANGW_DLC_MAX_SIZE]; -} CAN_MSG_CANGWDATA_DAT; - -/** -* \~english Message struct used to transfer CAN data to CANGW -* \~english (transfer message from CAN to user) -*/ -typedef struct { - /** - * \~english CAN data - */ - CAN_MSG_CANGWDATA_DAT data[CANGW_SND_NUM_MAX]; - /** - * \~english Number of CAN data(max 22) - */ - uint8_t num; -} CAN_MSG_CANGWDATA; - -/** -* \~english Data struct used to transfer CAN data -* \~english (transfer data from user to CANIF API) -*/ -typedef struct { - /** - * \~english CAN ID - */ - CANID can_id; - /** - * \~english Data Length - */ - uint8_t dlc; - /** - * \~english reserve - */ - uint8_t reserve[3]; - /** - * \~english DATA - */ - uint8_t data[CAN_DATA_SIZE + 1]; -} CAN_DATA; - -/** -* \~english Data struct used to transfer CAN data -* \~english (transfer data from CANIF API to CAN) -*/ -typedef struct { - /** - * \~english Delivery target thread name - */ - char notifyName[MAX_NAME_SIZE_APP]; - // uint32_t notifyId; /* Addresses for delivery ID */ - /** - * \~english Thread ID used by _CWORD64_ - */ - uint32_t ulEventId; - /** - * \~english Resource ID - */ - uint8_t ucRid; /* Resources ID */ - /** - * \~english Cycle of send message(Unit of 100ms) - */ - uint16_t usFreq; - /** - * \~english CAN DATA - */ - CAN_DATA stCandata; -} CAN_TRANSMISSION_START_MSG_DAT; - -/** -* \~english Data struct used to notify transmission result -* \~english (transfer data from CAN API to user) -*/ -typedef struct { - /** - * \~english CAN ID - */ - CANID ulCanid; - /** - * \~english Transmission result status - */ - uint8_t ucStatus; - /** - * \~english Reserve - */ - uint8_t reserve[3]; -} CAN_MSG_SENDSTS_DAT; - -/** -* \~english Message struct used to notify transmission result -* \~english (transfer message from CAN API to user) -*/ -typedef struct { - /** - * \~english header - */ - T_APIMSG_MSGBUF_HEADER_COMM hdr; - /** - * \~english Data - */ - CAN_MSG_SENDSTS_DAT data; -} CAN_MSG_SENDSTS; - -/** -* \~english Data struct used for regular transmission stop -* \~english (transfer data from CANIF API to CAN) -*/ -typedef struct { - /** - * \~english Delivery target thread name - */ - char notifyName[MAX_NAME_SIZE_APP]; - // uint32_t notifyId; /* Addresses for delivery ID */ - /** - * \~english Event ID that use for _CWORD64_ - */ - uint32_t ulEventId; - /** - * \~english CAN ID - */ - CANID ulCanid; -} CAN_FREQ_TRANS_STOP_MSG_DAT; - -/** -* \~english Data struct used for communication stop/restore -* \~english (transfer message from CAN to user) -*/ -typedef struct { - /** - * \~english Data ID - */ - DID ulDid; -} CAN_MSG_COMM_WATCHSTS_DAT; - -/** -* \~english Data struct used for communication stop/restore -* \~english (transfer message from CAN to user) -*/ -typedef struct { - /** - * \~english Header - */ - T_APIMSG_MSGBUF_HEADER_COMM hdr; - /** - * \~english Data - */ - CAN_MSG_COMM_WATCHSTS_DAT data; -} CAN_MSG_COMM_WATCHSTS; - -/** -* \~english Data struct used for delivery entry -* \~english (transfer data from CANIF API to CAN) -*/ -typedef struct { - /** - * \~english Delivery target thread name - */ - char notifyName[MAX_NAME_SIZE_APP]; - // uint32_t notifyId; /* Addresses for delivery ID */ - /** - * \~english Event ID use for _CWORD64_ - */ - uint32_t ulEventId; - /** - * \~english Number of CAN ID entry - */ - uint16_t usCanNum; - /** - * \~english CAN ID entry array - */ - CANID ulCanid[CAN_DELIVERY_CANID_ENTRY_MAX]; -} CAN_DELIVERY_ENTRY; - -/** -* \~english Data struct used for communication stop -* \~english (transfer data from CANIF API to CAN) -*/ -typedef struct { - /** - * \~english Delivery target thread name - */ - char notifyName[MAX_NAME_SIZE_APP]; /* Destination thread name */ - /** - * \~english Event ID - */ - uint32_t ulEvtId; - /** - * \~english CAN ID - */ - CANID ulCanid; - /** - * \~english Data ID - */ - DID ulDid; - /** - * \~english Watch time for commuication stop (Unit of 100ms) - */ - uint16_t usWatchTime; -} CAN_COMM_WATCH_MSG_DAT; - -/** -* \~english Data struct used for CAN command control -* \~english (transfer data from CANIF API to CAN) -*/ -typedef struct { - /** - * \~english Delivery target thread name - */ - char notifyName[MAX_NAME_SIZE_APP]; - // uint32_t notifyId; /* Transfer to: ID */ - /** - * \~english Event ID - */ - uint32_t ulEvtId; - /** - * \~english Resource ID - */ - uint8_t ucRid; - /** - * \~english CAN command ID - */ - uint8_t ucCmdid; -} CAN_CMD_CTRL_MSG_DAT; - -/** -* \~english Data struct used for CAN command delivery -* \~english (transfer data from CAN to user) -*/ -typedef struct { - /** - * \~english CAN command ID - */ - uint8_t cmd_id; - /** - * \~english Reserve - */ - uint8_t reserve[3]; - /** - * \~english Data - */ - uint8_t data[CANCMD_DAT_MAX]; -} CAN_MSG_CANCMD_DAT; - -/** -* \~english Message struct used for CAN command delivery -* \~english (transfer message from CAN to user) -*/ -typedef struct { - /** - * \~english Header - */ - T_APIMSG_MSGBUF_HEADER_COMM hdr; - /** - * \~english Data - */ - CAN_MSG_CANCMD_DAT data; -} CAN_MSG_CANCMD; - -/** -* \~english Data struct used for CAN command transmission result -* \~english (transfer data from CAN to user) -*/ -typedef struct { - /** - * \~english CAN command ID(same as delivery format) - */ - uint32_t cmd_id; - /** - * \~english Delivery result status - */ - uint8_t status; - /** - * \~english Reserve - */ - uint8_t reserve[3]; -} CAN_CMD_MSG_SENDSTS_DAT; - -/** -* \~english Data struct used for CAN command transmission result -* \~english (transfer data from CAN to user) -*/ -typedef struct { - /** - * \~english Header - */ - T_APIMSG_MSGBUF_HEADER_COMM hdr; - /** - * \~english Data - */ - CAN_CMD_MSG_SENDSTS_DAT data; -} CAN_CMD_MSG_SENDSTS; - -/** -* \~english Data struct for receiving message(work data) -*/ -typedef struct { - /** - * \~english Header - */ - T_APIMSG_MSGBUF_HEADER_COMM stHead; - /** - * \~english Data - */ - uint8_t ucData[CAN_MSGBUF_DATAMAX_SIZE]; -} CAN_MSG_DATA; - -/** -* \~english CAN data struct of communication stop registration -* \~english (transfer data from CANIF API to CAN) -*/ -typedef struct { - /** - * \~english Delivery target thread name - */ - char notifyName[MAX_NAME_SIZE_APP]; - /** - * \~english Event ID for _CWORD64_ - */ - uint32_t ulEvtId; - /** - * \~english CAN ID - */ - CANID ulCanid; - /** - * \~english Data ID - */ - DID ulDid; - /** - * \~english Watch time for communication stop(Unit of 100ms) - */ - uint16_t usWatchTime; - /** - * \~english has IG coopration or not - */ - uint8_t ucIg; -} CAN_COMM_WATCHEXT_MSG_DAT; - -/** -* \~english Mask data struct for CAN data -*/ -typedef struct { - /** - * \~english Mask data - */ - uint8_t dat[CAN_TXDATA_SIZE]; -} CAN_DATA_MASK; - -/** -* \~english Data struct used for CAN data transmission -*/ -typedef struct { - /** - * \~english Transmission data - */ - uint8_t dat[CAN_TXDATA_SIZE]; -} CAN_DATA_BIT; - -/** -* \~english Data struct used for CAN data transmission registration -*/ -typedef struct { - /** - * \~english CAN ID - */ - CANID id; - /** - * \~english Mask data - */ - CAN_DATA_MASK mask; - /** - * \~english Transmission data - */ - CAN_DATA_BIT dat; - /** - * \~english Cycle of regular transmission - */ - uint32_t freq; -} CAN_TRANS_START_MSG_DAT; - -/*********************************************************************** -* CANIF API Functions Prototypes * -************************************************************************/ -#if defined(__cplusplus) -extern "C" { -#endif - -/******************************************************************************* - * MODULE : Canif_DeliveryEntry - ******************************************************************************/ -//////////////////////////////////////////////////////////////////////////////// -/// \ingroup Canif_DeliveryEntry -/// \~english @par Brief -/// Delivery registration of CAN data -/// \~english @param [in] h_app -/// HANDLE - Handle for application -/// \~english @param [in] notify_name -/// PCSTR - Delivery target thread name -/// \~english @param [in] can_num -/// uint8_t - Number of delivery registration CAN ID -/// \~english @param [in] p_can_id -/// CANID* - Pointer of delivery registration CAN ID array -/// \~english @retval CANIF_RET_NORMAL Normality -/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter -/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination -/// \~english @par Prerequisite -/// None -/// \~english @par Change of internal state -/// - Change of internal state according to the API does not occur -/// \~english @par Conditions of processing failure -/// - h_app is NULL.[CANIF_RET_ERROR_PARAM] -/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes. -/// [CANIF_RET_ERROR_PARAM] -/// - can_num is 0 or bigger than 125.[CANIF_RET_ERROR_PARAM] -/// - CAN ID pointer is null.[CANIF_RET_ERROR_PARAM] -/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM] -/// - malloc failed to get the message queue management information area -/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - malloc failed to get the message queue name storage area for -/// transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - mq_open failed to open the message queue for transmission -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - The session message queue to communication service is full. -/// [CANIF_RET_ERROR_CANCEL] -/// - The transmission file descriptor of the session -/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL] -/// - The interruption by the system call (signal) occurred while -/// transmitting the session message to communication service. -/// [CANIF_RET_ERROR_CANCEL] -/// - Any error occurred in the transmission of the session message -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - It failed to access to the shared memory for the transmission of -/// session message to communication service. [CANIF_RET_ERROR_CANCEL] -/// \~english @par Classification -/// Public -/// \~english @par Type -/// Sync -/// \~english @par Detail -/// - Delivery registration of CAN data. \n -/// \~english @see None -//////////////////////////////////////////////////////////////////////////////// -CANIF_RET_API Canif_DeliveryEntry(HANDLE h_app, PCSTR notify_name, - uint8_t can_num, CANID *p_can_id); - -/******************************************************************************* - * MODULE : Canif_TransmissionStart - ******************************************************************************/ -//////////////////////////////////////////////////////////////////////////////// -/// \ingroup Canif_TransmissionStart -/// \~english @par Brief -/// CAN data transmission starting -/// \~english @param [in] h_app -/// HANDLE - Handle for application -/// \~english @param [in] notify_name -/// PCSTR - Delivery target thread name -/// \~english @param [in] rid -/// uint8_t - Resource ID for CAN data transmission result notification -/// \~english @param [in] freq -/// uint16_t - Cycle of regular transmission -/// \~english @param [in] p_data -/// CAN_DATA* - Pointer of transmission data -/// \~english @retval CANIF_RET_NORMAL Normality -/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter -/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination -/// \~english @par Prerequisite -/// None -/// \~english @par Change of internal state -/// - Change of internal state according to the API does not occur -/// \~english @par Conditions of processing failure -/// - h_app is NULL.[CANIF_RET_ERROR_PARAM] -/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes. -/// [CANIF_RET_ERROR_PARAM] -/// - Transmission data pointer is null.[CANIF_RET_ERROR_PARAM] -/// - DLC size is bigger than 8 bytes.[CANIF_RET_ERROR_PARAM] -/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM] -/// - CAN ID is not defined in the _CWORD108_ bit asignment table -/// [CANIF_RET_ERROR_PARAM] -/// - malloc failed to get the message queue management information area -/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - malloc failed to get the message queue name storage area for -/// transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - mq_open failed to open the message queue for transmission -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - The session message queue to communication service is full. -/// [CANIF_RET_ERROR_CANCEL] -/// - The transmission file descriptor of the session -/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL] -/// - The interruption by the system call (signal) occurred while -/// transmitting the session message to communication service. -/// [CANIF_RET_ERROR_CANCEL] -/// - Any error occurred in the transmission of the session message -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - It failed to access to the shared memory for the transmission of -/// session message to communication service. [CANIF_RET_ERROR_CANCEL] -/// \~english @par Classification -/// Public -/// \~english @par Type -/// ASync -/// \~english @par Detail -/// - The transmission of the CAN data starts(Regular/One). \n -/// \~english @see None -//////////////////////////////////////////////////////////////////////////////// -CANIF_RET_API Canif_TransmissionStart(HANDLE h_app, PCSTR notify_name, - uint8_t rid, uint16_t freq, CAN_DATA *p_data); - -/******************************************************************************* - * MODULE : Canif_CommandCtrl - ******************************************************************************/ -//////////////////////////////////////////////////////////////////////////////// -/// \ingroup Canif_CommandCtrl -/// \~english @par Brief -/// CAN command control -/// \~english @param [in] h_app -/// HANDLE - Handle for application -/// \~english @param [in] notify_name -/// PCSTR - Delivery target thread name -/// \~english @param [in] rid -/// uint8_t - Resource ID -/// \~english @param [in] cmd_id -/// uint32_t - CAN command ID(32bit) -/// \~english @retval CANIF_RET_NORMAL Normality -/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter -/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination -/// \~english @par Prerequisite -/// None -/// \~english @par Change of internal state -/// - Change of internal state according to the API does not occur -/// \~english @par Conditions of processing failure -/// - h_app is NULL.[CANIF_RET_ERROR_PARAM] -/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes. -/// [CANIF_RET_ERROR_PARAM] -/// - CAN command ID is invalid.[CANIF_RET_ERROR_PARAM] -/// - malloc failed to get the message queue management information area -/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - malloc failed to get the message queue name storage area for -/// transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - mq_open failed to open the message queue for transmission -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - The session message queue to communication service is full. -/// [CANIF_RET_ERROR_CANCEL] -/// - The transmission file descriptor of the session -/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL] -/// - The interruption by the system call (signal) occurred while -/// transmitting the session message to communication service. -/// [CANIF_RET_ERROR_CANCEL] -/// - Any error occurred in the transmission of the session message -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - It failed to access to the shared memory for the transmission of -/// session message to communication service. [CANIF_RET_ERROR_CANCEL] -/// \~english @par Classification -/// Public -/// \~english @par Type -/// ASync -/// \~english @par Detail -/// - Transmission control of CAN command. \n -/// \~english @see None -//////////////////////////////////////////////////////////////////////////////// -CANIF_RET_API Canif_CommandCtrl(HANDLE h_app, PCSTR notify_name, uint8_t rid, - uint32_t cmd_id); - -/******************************************************************************* - * MODULE : Canif_CommWatch - ******************************************************************************/ -//////////////////////////////////////////////////////////////////////////////// -/// \ingroup Canif_CommWatch -/// \~english @par Brief -/// CAN data regular transmission stop -/// \~english @param [in] h_app -/// HANDLE - Handle for application -/// \~english @param [in] notify_name -/// PCSTR - Delivery target thread name -/// \~english @param [in] can_id -/// CANID - CAN ID -/// \~english @param [in] did -/// DID - Data ID -/// \~english @param [in] watch_time -/// uint16_t - Communication watch suspension time(Unit of 100ms) -/// \~english @retval CANIF_RET_NORMAL Normality -/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter -/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination -/// \~english @par Prerequisite -/// None -/// \~english @par Change of internal state -/// - Change of internal state according to the API does not occur -/// \~english @par Conditions of processing failure -/// - h_app is NULL.[CANIF_RET_ERROR_PARAM] -/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes. -/// [CANIF_RET_ERROR_PARAM] -/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM] -/// - malloc failed to get the message queue management information area -/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - malloc failed to get the message queue name storage area for -/// transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - mq_open failed to open the message queue for transmission -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - The session message queue to communication service is full. -/// [CANIF_RET_ERROR_CANCEL] -/// - The transmission file descriptor of the session -/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL] -/// - The interruption by the system call (signal) occurred while -/// transmitting the session message to communication service. -/// [CANIF_RET_ERROR_CANCEL] -/// - Any error occurred in the transmission of the session message -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - It failed to access to the shared memory for the transmission of -/// session message to communication service. [CANIF_RET_ERROR_CANCEL] -/// \~english @par Classification -/// Public -/// \~english @par Type -/// Sync -/// \~english @par Detail -/// - CAN data regular transmission stop. \n -/// \~english @see None -//////////////////////////////////////////////////////////////////////////////// -CANIF_RET_API Canif_CommWatch(HANDLE h_app, PCSTR notify_name, CANID can_id, - DID did, uint16_t watch_time); - -//////////////////////////////////////////////////////////////////////////////// -/// \ingroup Canif_TransStart -/// \~english @par Brief -/// Transmission CAN Command -/// \~english @param [in] h_app -/// HANDLE - Handle for application -/// \~english @param [in] can_id -/// CANID - CAN ID -/// \~english @param [in] mask -/// CAN_DATA_MASK* - Mask Data -/// \~english @param [in] dat -/// CAN_DATA_BIT* - Transmission Data -/// \~english @param [in] freq -/// uint32_t - Transmission Cycle -/// \~english @retval CANIF_RET_NORMAL Normality -/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter -/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination -/// \~english @par Prerequisite -/// None -/// \~english @par Change of internal state -/// - Change of internal state according to the API does not occur -/// \~english @par Conditions of processing failure -/// - h_app is NULL.[CANIF_RET_ERROR_PARAM] -/// - Transmission Cycle is bigger than 0xFFFF.[CANIF_RET_ERROR_PARAM] -/// - CAN ID is NULL.[CANIF_RET_ERROR_PARAM] -/// - Mask Data is NULL.[CANIF_RET_ERROR_PARAM] -/// - Transmission Data is NULL.[CANIF_RET_ERROR_PARAM] -/// - CAN ID is not defined in the _CWORD108_ bit asignment table -/// [CANIF_RET_ERROR_PARAM] -/// - The upper 3bits of CAN ID are not 0.[CANIF_RET_ERROR_PARAM] -/// - malloc failed to get the message queue management information area -/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - malloc failed to get the message queue name storage area for -/// transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - mq_open failed to open the message queue for transmission -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - The session message queue to communication service is full. -/// [CANIF_RET_ERROR_CANCEL] -/// - The transmission file descriptor of the session -/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL] -/// - The interruption by the system call (signal) occurred while -/// transmitting the session message to communication service. -/// [CANIF_RET_ERROR_CANCEL] -/// - Any error occurred in the transmission of the session message -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - It failed to access to the shared memory for the transmission of -/// session message to communication service. [CANIF_RET_ERROR_CANCEL] -/// \~english @par Classification -/// Public -/// \~english @par Type -/// ASync -/// \~english @par Detail -/// - Start Transmission CAN Command API. \n -/// \~english @see None -//////////////////////////////////////////////////////////////////////////////// -CANIF_RET_API Canif_TransStart(HANDLE h_app, CANID can_id, CAN_DATA_MASK *mask, - CAN_DATA_BIT *dat, uint32_t freq); - -//////////////////////////////////////////////////////////////////////////////// -/// \ingroup Canif_DeliveryEraseAll -/// \~english @par Brief -/// Delete all delivery entry -/// \~english @param [in] h_app -/// HANDLE - Handle for application -/// \~english @param [in] notify_name -/// PCSTR - Delivery target thread name -/// \~english @retval CANIF_RET_NORMAL Normality -/// \~english @retval CANIF_RET_ERROR_PARAM Abnormality of parameter -/// \~english @retval CANIF_RET_ERROR_CANCEL Abnormal termination -/// \~english @par Prerequisite -/// None -/// \~english @par Change of internal state -/// - Change of internal state according to the API does not occur -/// \~english @par Conditions of processing failure -/// - h_app is NULL.[CANIF_RET_ERROR_PARAM] -/// -notify_nameis NULL or the length ofnotify_nameis longer than 15 bytes. -/// [CANIF_RET_ERROR_PARAM] -/// - malloc failed to get the message queue management information area -/// for transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - malloc failed to get the message queue name storage area for -/// transmission to communication service. [CANIF_RET_ERROR_CANCEL] -/// - mq_open failed to open the message queue for transmission -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - The session message queue to communication service is full. -/// [CANIF_RET_ERROR_CANCEL] -/// - The transmission file descriptor of the session -/// message to communication service is invalid. [CANIF_RET_ERROR_CANCEL] -/// - The interruption by the system call (signal) occurred while -/// transmitting the session message to communication service. -/// [CANIF_RET_ERROR_CANCEL] -/// - Any error occurred in the transmission of the session message -/// to communication service. [CANIF_RET_ERROR_CANCEL] -/// - It failed to access to the shared memory for the transmission of -/// session message to communication service. [CANIF_RET_ERROR_CANCEL] -/// \~english @par Classification -/// Public -/// \~english @par Type -/// Sync -/// \~english @par Detail -/// - Delete all delivery entry. \n -/// \~english @see None -//////////////////////////////////////////////////////////////////////////////// -CANIF_RET_API Canif_DeliveryEraseAll(HANDLE h_app, PCSTR notify_name); - -/** @}*/ // end of CAN -/** @}*/ // end of communication -/** @}*/ // end of peripheral_service -/** @}*/ // end of BaseSystem - -#if defined(__cplusplus) -} -#endif - -#endif // COMMUNICATION_CLIENT_CAN_INCLUDE_PERIPHERAL_SERVICE_CANIF_API_H_ diff --git a/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/communication_can.h b/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/communication_can.h deleted file mode 100755 index 8b6119a..0000000 --- a/video_in_hal/peripheralservice/communication/client_can/include/peripheral_service/communication_can.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// @copyright Copyright (c) 2017-2020 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. -// - -#ifndef PERIPHERALSERVICE_COMMUNICATIONCAN_H_ // NOLINT(build/header_guard) -#define PERIPHERALSERVICE_COMMUNICATIONCAN_H_ // NOLINT(build/header_guard) - -/** - * @file communication_can.h - * @~english - * @brief communication_can unit header - */ - -#include <peripheral_service/Canif_API.h> - -#endif // PERIPHERALSERVICE_COMMUNICATIONCAN_H_ diff --git a/video_in_hal/peripheralservice/communication/client_can/libCAN_API.ver b/video_in_hal/peripheralservice/communication/client_can/libCAN_API.ver deleted file mode 100755 index 47e5e86..0000000 --- a/video_in_hal/peripheralservice/communication/client_can/libCAN_API.ver +++ /dev/null @@ -1,36 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -######################### -# lib_CWORD83_ version script # -######################### -{ - global: - ### .text section ### - Canif_DeliveryEntry; - Canif_DeliveryEraseAll; - Canif_TransmissionStart; - Canif_TransmissionStop; - Canif_CommandCtrl; - Canif_CommWatch; - Canif_TransStart; - Canif_TransStop; - Canif_Send; - ### .data section ### - local: - *; -}; - diff --git a/video_in_hal/peripheralservice/communication/client_can/src/Canif_API.cpp b/video_in_hal/peripheralservice/communication/client_can/src/Canif_API.cpp deleted file mode 100755 index 499d187..0000000 --- a/video_in_hal/peripheralservice/communication/client_can/src/Canif_API.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ -#include <stdio.h> -#include <string.h> -#include <fcntl.h> -#include <native_service/frameworkunified_framework_if.h> -#include <peripheral_service/Canif_API.h> - -#include "API_Local_Common.h" -#include "Canif_API_Local.h" -#include "Canif_TransmissionData.h" -#include "com_error_type.h" - -static __thread HANDLE g_sender = NULL; - -static EFrameworkunifiedStatus CanifMsgToSrv(HANDLE h, UI_32 cmd, size_t len, PCVOID data) { - if (data == NULL) - return eFrameworkunifiedStatusFail; - - if (len > UINT32_MAX) - return eFrameworkunifiedStatusFail; - - if (g_sender == NULL) { - g_sender = FrameworkunifiedMcOpenSender(h, LAN_SERVICE_CAN); - if (g_sender == NULL) - return eFrameworkunifiedStatusFail; - } - return FrameworkunifiedSendMsg(g_sender, cmd, (UI_32)len, data); -} - -CANIF_RET_API Canif_DeliveryEntry(HANDLE h_app, PCSTR notify_name, - uint8_t can_num, CANID *p_can_id) { - - CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM; - CAN_DELIVERY_ENTRY pst_delivery_entry; - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - PS_Communication_InternalProtocol cmd = CID_CANIF_DELIVERY_ENTRY; - void *tx = reinterpret_cast<void *>(&pst_delivery_entry); - size_t len = sizeof(pst_delivery_entry); - memset(tx, 0x0, len); - int32_t i; - - if (NULL == h_app) - goto cleanup; - - if (NULL == p_can_id) - goto cleanup; - - if (!Canif_CheckNotifyName(notify_name)) - goto cleanup; - - if (0 == can_num) - goto cleanup; - - if (CAN_DELIVERY_CANID_ENTRY_MAX < can_num) - goto cleanup; - - for (i = 0; i < (int32_t)can_num; i++) { - if (!Canif_CheckCanID(p_can_id[i])) - goto cleanup; - } - - Canif_CopyNotifyName(pst_delivery_entry.notifyName, notify_name); - pst_delivery_entry.usCanNum = (uint16_t)can_num; - memcpy(pst_delivery_entry.ulCanid, p_can_id, sizeof(CANID) * can_num); - - e_status = CanifMsgToSrv(h_app, cmd, len, tx); - if (e_status != eFrameworkunifiedStatusOK) { - l_ret = CANIF_RET_ERROR_CANCEL; - goto cleanup; - } - - l_ret = CANIF_RET_NORMAL; -cleanup: - return l_ret; -} - -CANIF_RET_API Canif_TransmissionStart(HANDLE h_app, PCSTR notify_name, - uint8_t rid, uint16_t freq, CAN_DATA *p_data) { - - CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM; - CAN_TRANSMISSION_START_MSG_DAT pst_transmission_start; - PS_Communication_InternalProtocol cmd = CID_CANIF_TX_START; - void *tx = reinterpret_cast<void *>(&pst_transmission_start); - size_t len = sizeof(pst_transmission_start); - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - PCSTR _notify_name = notify_name; - memset(tx, 0x0, len); - - if (h_app == NULL) - goto cleanup; - - if (p_data == NULL) - goto cleanup; - - if (rid == 0xFF) { - _notify_name = ""; // using dummy name; - } - - if (!Canif_CheckNotifyName(_notify_name)) - goto cleanup; - - if (CAN_TXDATA_SIZE < (p_data->dlc)) - goto cleanup; - - if (!Canif_CheckCanID(p_data->can_id)) - goto cleanup; - - if (!Canif_InitDataIsDefined21PF(p_data->can_id)) - goto cleanup; - - Canif_CopyNotifyName(pst_transmission_start.notifyName, _notify_name); - pst_transmission_start.ucRid = rid; - pst_transmission_start.usFreq = freq; - memcpy(reinterpret_cast<void *>(&pst_transmission_start.stCandata), - reinterpret_cast<int8_t *>(p_data), (size_t)sizeof(CAN_DATA)); - e_status = CanifMsgToSrv(h_app, cmd, len, tx); - if (e_status != eFrameworkunifiedStatusOK) { - l_ret = CANIF_RET_ERROR_CANCEL; - goto cleanup; - } - - l_ret = CANIF_RET_NORMAL; -cleanup: - return l_ret; -} - -CANIF_RET_API Canif_CommandCtrl(HANDLE h_app, PCSTR notify_name, uint8_t rid, - uint32_t cmd_id) { - - CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM; - CAN_CMD_CTRL_MSG_DAT pst_cmd_ctrl_msg; - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - PS_Communication_InternalProtocol cmd = CID_CANIF_CMD_CTRL; - void *tx = reinterpret_cast<void *>(&pst_cmd_ctrl_msg); - size_t len = sizeof(pst_cmd_ctrl_msg); - PCSTR _notify_name = notify_name; - memset(tx, 0x0, len); - - if (!Canif_IsCommand(cmd_id)) - goto cleanup; - - if (h_app == NULL) - goto cleanup; - - if (rid == 0xFF) { - _notify_name = ""; // using dummy name; - } - - if (!Canif_CheckNotifyName(_notify_name)) - goto cleanup; - - Canif_CopyNotifyName(pst_cmd_ctrl_msg.notifyName, _notify_name); - pst_cmd_ctrl_msg.ucRid = rid; - pst_cmd_ctrl_msg.ucCmdid = (uint8_t)cmd_id; - - e_status = CanifMsgToSrv(h_app, cmd, len, tx); - if (e_status != eFrameworkunifiedStatusOK) { - l_ret = CANIF_RET_ERROR_CANCEL; - goto cleanup; - } - - l_ret = CANIF_RET_NORMAL; -cleanup: - return l_ret; -} - -CANIF_RET_API Canif_CommWatch(HANDLE h_app, PCSTR notify_name, CANID can_id, - DID did, uint16_t watch_time) { - - CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM; - CAN_COMM_WATCHEXT_MSG_DAT pst_comm_watch_msg; - PS_Communication_InternalProtocol cmd = CID_CANIF_COMM_WATCH; - void *tx = reinterpret_cast<void *>(&pst_comm_watch_msg); - size_t len = sizeof(pst_comm_watch_msg); - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - memset(tx, 0x0, len); - - if (h_app == NULL) - goto cleanup; - - if (!Canif_CheckNotifyName(notify_name)) - goto cleanup; - - if (!Canif_CheckCanID(can_id)) - goto cleanup; - - Canif_CopyNotifyName(pst_comm_watch_msg.notifyName, notify_name); - pst_comm_watch_msg.ulCanid = can_id; - pst_comm_watch_msg.ulDid = did; - pst_comm_watch_msg.ucIg = CAN_IG_COOPERATION_OFF; - pst_comm_watch_msg.usWatchTime = watch_time; - - e_status = CanifMsgToSrv(h_app, cmd, len, tx); - if (e_status != eFrameworkunifiedStatusOK) { - l_ret = CANIF_RET_ERROR_CANCEL; - goto cleanup; - } - - l_ret = CANIF_RET_NORMAL; -cleanup: - return l_ret; -} - -CANIF_RET_API Canif_TransStart(HANDLE h_app, CANID can_id, - CAN_DATA_MASK *mask, CAN_DATA_BIT *dat, uint32_t freq) { - CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM; - CAN_TRANS_START_MSG_DAT pst_trans_start; - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - PS_Communication_InternalProtocol cmd = CID_CANIF_TX_BIT_START; - void *tx = reinterpret_cast<void *>(&pst_trans_start); - size_t len = sizeof(pst_trans_start); - memset(tx, 0x0, len); - - if (h_app == NULL) - goto cleanup; - - if (!Canif_CheckCanID(can_id)) - goto cleanup; - - if (!Canif_InitDataIsDefined21PF(can_id)) - goto cleanup; - - if (mask == NULL) - goto cleanup; - - if (dat == NULL) - goto cleanup; - - if (0xFFFF < freq) - goto cleanup; - - pst_trans_start.id = can_id; - pst_trans_start.freq = freq; - memcpy(&pst_trans_start.mask.dat, mask->dat, sizeof(mask->dat)); - memcpy(&pst_trans_start.dat.dat, dat->dat, sizeof(dat->dat)); - - e_status = CanifMsgToSrv(h_app, cmd, len, tx); - if (e_status != eFrameworkunifiedStatusOK) { - l_ret = CANIF_RET_ERROR_CANCEL; - goto cleanup; - } - - l_ret = CANIF_RET_NORMAL; -cleanup: - return l_ret; -} - -CANIF_RET_API Canif_DeliveryEraseAll(HANDLE h_app, PCSTR notify_name) { - CANIF_RET_API l_ret = CANIF_RET_ERROR_PARAM; - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - HANDLE handle[NUM_OF_CANIF_PROTOCOL]; - int i = 0; - - for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) { - handle[i] = NULL; - } - - if (NULL == h_app) - goto cleanup; - - if (!Canif_CheckNotifyName(notify_name)) - goto cleanup; - - l_ret = CANIF_RET_ERROR_CANCEL; - for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) { - handle[i] = FrameworkunifiedMcOpenSender(h_app, - Canif_PidxTosname((enum CANIF_PROTOCOL_IDX)i)); - if (!handle[i]) - goto cleanup; - } - - for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) { - e_status = FrameworkunifiedSendMsg(handle[i], CID_CANIF_DELIVERY_ERASE, - CANIF_NOTIFY_NAME_MAX_SIZE, (PCVOID)notify_name); - if (e_status != eFrameworkunifiedStatusOK) - goto cleanup; - } - - l_ret = CANIF_RET_NORMAL; -cleanup: - for (i = 0; i < NUM_OF_CANIF_PROTOCOL; i++) { - if (handle[i] != NULL) - FrameworkunifiedMcClose(handle[i]); - } - return l_ret; -} - diff --git a/video_in_hal/peripheralservice/communication/server/Makefile b/video_in_hal/peripheralservice/communication/server/Makefile deleted file mode 100755 index 069c333..0000000 --- a/video_in_hal/peripheralservice/communication/server/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -# -# @copyright Copyright (c) 2016-2020 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. -# - -######### add source path ############# - -######### installed program ############# -INST_PROGS = communication - -######### installed library(*.a) ############# - -######### installed shared library(*.so) ############# - -######### compiled sources ############# - -## from ./src/main -communication_SRCS += ./src/main/communication_main.cpp -communication_SRCS += ./src/main/communication_application.cpp - -## from ./src/threads -communication_SRCS += ./src/threads/CAN_Thread.cpp -communication_SRCS += ./src/threads/Thread_Common.cpp - -## from ./src/CAN/CommWatch/ -communication_SRCS += ./src/CAN/CommWatch/CAN_CommWatch.cpp - -## from ./src/CAN/Delivery/ -communication_SRCS += ./src/CAN/Delivery/CAN_Delivery.cpp - -## from ./src/CAN/TxMsg/ -communication_SRCS += ./src/CAN/TxMsg/CAN_TxMsg.cpp - -######### add source path ############# -VPATH += \ - ./src/CAN/Command \ - ./src/CAN/CommWatch \ - ./src/CAN/Delivery \ - ./src/CAN/main \ - ./src/CAN/TxMsg \ - ./src/main \ - - -######### add include path ############# -CPPFLAGS += \ - -I./../client_can/include \ - -I./include \ - -I./include/CAN/Command \ - -I./include/CAN/CommWatch \ - -I./include/CAN/Delivery \ - -I./include/CAN/main \ - -I./include/CAN/TimerCtrl \ - -I./include/CAN/TxMsg \ - -I./include/main \ - -I./include/threads \ - -I./include/private - -######### add compile option ############# -CPPFLAGS += -DLINUX -fdata-sections -ffunction-sections -DFLG_CORE - -CPPFLAGS += -Werror=implicit-function-declaration -CPPFLAGS += -Werror=format-security - -CPPFLAGS += -Wconversion -CPPFLAGS += -Wint-to-pointer-cast -CPPFLAGS += -Wpointer-arith -CPPFLAGS += -Wformat - -CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND - -######### add library path ############# -LDFLAGS += -Wl,--no-as-needed -LDFLAGS += -Wl,--no-undefined -LDFLAGS += -Wl,--gc-sections - -######### linked library (dynamic) ############# -LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy -LDLIBS += -Wl,-Bdynamic -lrt -LDLIBS += -Wl,-Bdynamic -lstdc++ -LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified -LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified -LDLIBS += -Wl,-Bdynamic -lcommon -LDLIBS += -Wl,-Bdynamic -lcan_hal - -include ../../peripheral_service.mk diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h b/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h deleted file mode 100755 index 16aa54f..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CAN_CommWatch.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_ -#include <native_service/frameworkunified_types.h> -#include <peripheral_service/Canif_API.h> -#include <vector> -#include <map> -#include <string> -#include "CommWatchCommon.h" - -typedef struct { - char notify_name[MAX_NAME_SIZE_APP]; - uint32_t data_id; - uint8_t comm_watch_flag; - uint16_t set_time; - uint16_t timer_cnt; -} CAN_COMM_WATCH_VAL; - -typedef std::multimap<CANID, CAN_COMM_WATCH_VAL> CAN_CommWatchTable; -typedef std::pair<const CANID, CAN_COMM_WATCH_VAL> CAN_CommWatchTablePair; -typedef CAN_CommWatchTable::iterator CAN_CommWatchTableIt; - -void CANCommWatchInit(void); -EFrameworkunifiedStatus CANCommWatch(HANDLE h_app); -EFrameworkunifiedStatus CANCommWatchTimeout(HANDLE h_app); -void CANCommWatchClear(HANDLE h_app, CANID id); -#endif // COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_CAN_COMMWATCH_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h b/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h deleted file mode 100755 index 7306214..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/CAN/CommWatch/CommWatchCommon.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_COMMWATCH_COMMON_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMWATCH_COMMWATCH_COMMON_H_ -#define CAN_COMM_OFF 0x00 -#define CAN_COMM_NORMAL 0x01 -#define CAN_COMM_STOP 0x02 -#endif diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/Command/CAN_Command.h b/video_in_hal/peripheralservice/communication/server/include/CAN/Command/CAN_Command.h deleted file mode 100755 index 43abcdc..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/CAN/Command/CAN_Command.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_ -EFrameworkunifiedStatus CANCommandTransmission(HANDLE h_app); -RET_CAN CANCommandTxRslt(HANDLE h_app, CAN_MSG_DATA*); -#endif // COMMUNICATION_SERVER_INCLUDE_CAN_COMMAND_CAN_COMMAND_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h b/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h deleted file mode 100755 index 01f2e2f..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_Delivery.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_ -#include <native_service/frameworkunified_types.h> -#include "CAN_Thread.h" -#include <vector> -#include <map> -#include <string> -#include <can_hal.h> - -typedef std::multimap<CANID, std::string> CAN_DeliveryEntryList; -typedef CAN_DeliveryEntryList::iterator CAN_DeliveryEntryListIt; -typedef std::pair<const CANID, std::string> CAN_DeliveryEntryListPair; - -void CANDeliveryInit(void); -bool CANDeliveryInsert(CANID canid, std::string s); -EFrameworkunifiedStatus CANDeliveryRcvProcess(HANDLE h_app, CanMessage *msg); -EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app); -EFrameworkunifiedStatus CANClearEntry(HANDLE h_app); -EFrameworkunifiedStatus CANDeliverySndMsg(HANDLE h_app, CANID ul_canid, uint8_t n_ta, - uint8_t uc_dlc, const uint8_t *puc_data, - PS_CommunicationProtocol cid, enum CanIfEchoBackFlags flag = CANIF_PURERECV); -EFrameworkunifiedStatus CANCommandDeliveryRcvProcess(HANDLE h_app, - CanMessage *msg, uint8_t cmd); -#endif // COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERY_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h b/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h deleted file mode 100755 index ae0302c..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/CAN/Delivery/CAN_DeliveryData.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERYDATA_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERYDATA_H_ -/****************************************************************************** - * FILE :CAN_DeliveryData.h - * SYSTEM :_CWORD107_ - * SUBSYSTEM : ------------------------------------------------------------------------------*/ -#include <native_service/frameworkunified_types.h> -#include <peripheral_service/Canif_API.h> - -/************************************************************************ -* Macro definitions * -************************************************************************/ -/* Data size relationship */ -#define CAN_DELIVERY_LIST_NUM 400 /* Maximum number of delivery destination management tables */ -#define CAN_DELIVERY_CANID_LIST_NUM 150 /* Delivery CAN ID control table max. */ - -#define CAN_EXRCV_DATA_NUM 22 /* CAN Extended Reception Notification CAN Maximum Number of Data */ -#define CAN_EXRCV_DATA_SIZE 11 /* CAN Extended Reception Notification CAN Data Size */ -#define CAN_EXRCV_CANNUM_SIZE 1 /* CAN Extended Reception Notification CAN Data Number Size */ -#define CAN_EXRCV_DLC_MIN 1 /* CAN Extended Reception Notification DLC Minimum Value */ -#define CAN_EXRCV_DLC_MAX 8 /* CAN Extended Reception Notification DLC Maximum Value */ - -/* Flag relationship */ -#define CAN_DELIVERY_OFF 0 /* Stopping data delivery */ -#define CAN_DELIVERY_ON 1 /* Data delivery in progress */ - -/* CANDataControl code relationship used in the delivery relationship */ -#define CAN_DELIVERYLIST_STOP_CODE 0xFFFF /* Shipping Destination Management Table Stop Code */ - -#define CAN_CANIDLIST_EMPTY 0xFFFF /* Availability of CAN ID control table */ -/************************************************************************ -* Struct definitions -************************************************************************/ -/*************************************************** -* TAG : CAN_DELIVERY_DAT -* ABSTRACT : Destination management table structure (1 item) -* (CAN internal data management table) -****************************************************/ -typedef struct { /* Type definition of delivery destination management data (1 item) */ - CANID ul_canid; /* CAN ID */ - char notify_name[MAX_NAME_SIZE_APP]; /* Destination thread name */ - // uint32_t notifyId; /* Addresses for delivery ID */ - uint8_t uc_delivery_on; /* Delivery operation */ - uint8_t reserve1; /* Reserved */ - uint16_t us_link_id; /* Link ID */ - uint8_t reserve2[2]; /* Reserved */ -} CAN_DELIVERY_DAT; - -/*************************************************** -* TAG : CAN_DELIVERY_LIST_DAT -* ABSTRACT : Destination management table structure (all) -* (CAN internal data management table) -****************************************************/ -typedef struct { /* Type definition of the shipping management table */ - uint16_t us_entry_num; /* Registered number */ - uint8_t reserve[2]; /* Reserved */ - CAN_DELIVERY_DAT st_list[CAN_DELIVERY_LIST_NUM]; /* Delivery destination management data */ -} CAN_DELIVERY_LIST_DAT; - -/*************************************************** -* TAG : CAN_DELIVERY_SPACE_DAT -* ABSTRACT : Free space management structure in the destination management table (all) -* (CAN internal data management table free space management table) -****************************************************/ -typedef struct { /* Type definitions for free space management tables */ - uint16_t space_num; /* Number of free spaces */ - uint16_t index_list[CAN_DELIVERY_LIST_NUM]; /* Free space index list */ -} CAN_DELIVERY_SPACE_DAT; - -/*************************************************** -* TAG : CAN_CANID_DAT -* ABSTRACT : Transport CAN ID control table structures (1 item) -* (CAN internal data management table) -****************************************************/ -typedef struct { /* Defining the type of delivery destination CAN ID (1 item) */ - CANID ul_canid; /* CAN ID */ - uint16_t us_start_id; /* Start ID */ - uint16_t us_end_id; /* End ID */ - uint16_t us_data_num; /* Number of data items */ - uint8_t reserve[2]; /* Reserved */ -} CAN_CANID_DAT; - -/*************************************************** -* TAG : CAN_CANID_LIST_DAT -* ABSTRACT : Delivery CAN ID control table structures (all) -* (CAN internal data management table) -****************************************************/ -typedef struct { /* Type definitions for the target CAN ID administration table */ - uint16_t us_entry_num; /* Registered number */ - uint8_t reserve[2]; /* Reserved */ - CAN_CANID_DAT st_list[CAN_DELIVERY_CANID_LIST_NUM]; /* Shipping CAN ID */ -} CAN_CANID_LIST_DAT; - -/*************************************************** -* TAG : CAN_DELIVERY_SND_DAT -* ABSTRACT : Destination thread name for sending a message of delivery data -* (CAN-internal Work) -****************************************************/ -/* Type definition of the target thread name list data to which the message is sent */ -typedef struct { - int32_t i_num; /* Number of messages sent */ - char notify_name[CAN_DELIVERY_LIST_NUM][MAX_NAME_SIZE_APP]; /* Destination thread name */ -} CAN_DELIVERY_SND_DAT; - -typedef struct { - CAN_DELIVERY_LIST_DAT* p_dlvry_list; - CAN_DELIVERY_SPACE_DAT* p_dlvry_space; - CAN_CANID_LIST_DAT* p_canid_list; - CAN_DELIVERY_SND_DAT* p_dlvry_snd; -} CAN_STRUCT_PTR; - -/************************************************************************ -* Function prototype * -************************************************************************/ -void CANDeliveryDataInit(void); /* CANDataDelivery Management Data Initialization Process */ -EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app); /* CANDataDelivery registration process */ -void CANDeliveryBufferOut(FILE* fp_log); /* CAN shipping table log output processing */ -EFrameworkunifiedStatus CANClearEntry(HANDLE h_app); - -#endif // COMMUNICATION_SERVER_INCLUDE_CAN_DELIVERY_CAN_DELIVERYDATA_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h b/video_in_hal/peripheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h deleted file mode 100755 index dc4f6e8..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/CAN/TxMsg/CAN_TxMsg.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#ifndef COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_ -#define COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_ -#include <vector> -#include <map> -#include <string> -#include <can_hal.h> -#include "CAN_Thread.h" -#include "API_Local_Common.h" -#include "Canif_API_Local.h" - - -#define CAN_OPC_PAC_RX 0x00 -#define CAN_OPC_COMMAND_STARTUP_FIN_REQ_TX 0x00 // CAN start completion notification request transmission -#define CAN_OPC_COMMAND_MRST_INFO_REQ_TX 0x01 // CAN master reset information notification request transmission -#define CAN_OPC_COMMAND_VERSION_REQ_TX 0x02 // CAN Version Request Send -#define CAN_OPC_COMMAND_CONNECTION_NODE_REQ_TX 0x03 // CAN connection node notification request transmission -#define CAN_OPC_COMMAND_BUS_STATUS_REQ_TX 0x04 // CAN bus status notification request transmission -#define CAN_OPC_COMMAND_FUELCALC_REQ_TX 0x05 // CAN section flame reset response transmission -#define CAN_OPC_COMMAND_STARTUP_FIN_RESP_RX 0x06 // CAN startup completion notice received -#define CAN_OPC_COMMAND_MRST_INFO_RESP_RX 0x07 // CAN Master Reset Information Notification Reception -#define CAN_OPC_COMMAND_VERSION_RESP_RX 0x08 // CAN Version Response Reception -#define CAN_OPC_COMMAND_CONNECTION_NODE_RESP_RX 0x09 // Receive CAN Connection Node Notification Response -#define CAN_OPC_COMMAND_BUS_STATUS_RESP_RX 0x10 // CAN Bus Status Notification Response Reception -#define CAN_OPC_COMMAND_FUELCALC_RST_REQ_RX 0x11 // RECEIVE REQUEST FREE OF CAN SECTION - -typedef struct { - uint8_t rid; - char notify_name[CANIF_NOTIFY_NAME_MAX_SIZE + 1]; -} CAN_SEND_STATUS_DAT; - -void CANTxMsgInit(void); -EFrameworkunifiedStatus CANTxMsg(HANDLE h_app); -EFrameworkunifiedStatus CANTxMsgBit(HANDLE h_app); -void CANCommandSetFuelCalcRstReq(void); -EFrameworkunifiedStatus CANTxMsgCommand(HANDLE h_app); -EFrameworkunifiedStatus CANSndStsProcess(HANDLE h_app, CanSendResult *rcv_msg, - PS_CommunicationProtocol cid); -#endif // COMMUNICATION_SERVER_INCLUDE_CAN_TXMSG_CAN_TXMSG_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/com_error_type.h b/video_in_hal/peripheralservice/communication/server/include/com_error_type.h deleted file mode 100755 index 4d15f82..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/com_error_type.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#ifndef COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_ -#define COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_ -const int32_t RET_NORMAL = 0; -const int32_t RET_ERROR = -1; -#endif // COMMUNICATION_SERVER_INCLUDE_COM_ERROR_TYPE_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/main/communication_cid.h b/video_in_hal/peripheralservice/communication/server/include/main/communication_cid.h deleted file mode 100755 index d817624..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/main/communication_cid.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -/* - * This file has been generated automatically. - * User hand written code entry is not allowed. Do not modify the file content. - * - */ -#ifndef COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_ -#define COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_ - -#define LAN_SERVICE_MAIN "Communication" - -typedef enum PSCommunicationServiceProtocol { - CID_COMMSYS_MSG_BASE = PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD, // Base command id. - CID_COMMSYS_CAN_READY, // CAN_COM_PROT->Communication - CID_COMMSYS_TIMEOUT, // Communication->CAN -} PS_CommunicationServiceProtocol; - -#endif // COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_CID_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/main/communication_communicationlog.h b/video_in_hal/peripheralservice/communication/server/include/main/communication_communicationlog.h deleted file mode 100755 index 37016ad..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/main/communication_communicationlog.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -/////////////////////////////////////////////////////////////////////////////// -/// \ingroup -/// \brief -/// -/// -/// -/// -/// -/////////////////////////////////////////////////////////////////////////////// - -/* - * This file has been generated automatically. - * User hand written code entry is not allowed. Do not modify the file content. - * - */ -#ifndef COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_COMMUNICATIONLOG_H_ -#define COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_COMMUNICATIONLOG_H_ - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Include Files -//////////////////////////////////////////////////////////////////////////////////////////////////// -#include <native_service/ns_logger_if.h> - -#define ZONE_INIT ZONEMASK(10) -#define ZONE_FUNC ZONEMASK(11) -#define ZONE_MEM ZONEMASK(12) -#define ZONE_APP ZONEMASK(13) -#define ZONE__CWORD83__DEBUG ZONEMASK(14) -#define ZONE_CAN_DEBUG ZONEMASK(15) -#define ZONE_16 ZONEMASK(16) -#define ZONE_COMMSYS ZONEMASK(17) -#define ZONE_ICR ZONEMASK(18) -#define ZONE_ICR_TABLE ZONEMASK(19) -#define ZONE_TRANSLOG ZONEMASK(20) -#define ZONE_LOOPBACK ZONEMASK(22) -#define ZONE_ENTRY ZONEMASK(23) -#define ZONE_24 ZONEMASK(24) -#define ZONE_25 ZONEMASK(25) -#define ZONE_26 ZONEMASK(26) -#define ZONE_27 ZONEMASK(27) -#define ZONE_DEBUG ZONEMASK(28) -#define ZONE_INFO ZONEMASK(29) -#define ZONE_WARN ZONEMASK(30) -#define ZONE_ERR ZONEMASK(31) -#define ZONE_COMM_SYS_STS ZONEMASK(107) - -#define ZONE_TEXT_10 "Init" -#define ZONE_TEXT_11 "Function" -#define ZONE_TEXT_12 "Memory" -#define ZONE_TEXT_13 "StateMachine Example" -#define ZONE_TEXT_14 "_CWORD83_" -#define ZONE_TEXT_15 "CAN" -#define ZONE_TEXT_16 "" -#define ZONE_TEXT_17 "COMSYS" -#define ZONE_TEXT_18 "ICR" -#define ZONE_TEXT_19 "ICR_TABLE" -#define ZONE_TEXT_20 "TRANSLOG" -#define ZONE_TEXT_21 "" -#define ZONE_TEXT_22 "" -#define ZONE_TEXT_23 "" -#define ZONE_TEXT_24 "" -#define ZONE_TEXT_25 "" -#define ZONE_TEXT_26 "" -#define ZONE_TEXT_27 "" -#define ZONE_TEXT_28 "Debug" -#define ZONE_TEXT_29 "Info" -#define ZONE_TEXT_30 "Warning" -#define ZONE_TEXT_31 "Error" - -#ifndef FRAMEWORKUNIFIEDLOGOPTIONS -#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT , LMSGQ, LSLOGGER -#endif - -#ifndef FRAMEWORKUNIFIEDLOGAPPZONES -#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_APP, ZONE_ERR, ZONE_WARN, ZONE_INFO, ZONE_COMM_SYS, ZONE_CAN_FILTER, ZONE_COMM_SYS_STS -#endif - -#endif // COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_COMMUNICATIONLOG_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/main/communication_version.h b/video_in_hal/peripheralservice/communication/server/include/main/communication_version.h deleted file mode 100755 index 7cd2c3b..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/main/communication_version.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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 version.h -/// \ingroup -/// \version 0.1.0 -/// \brief -/// -/// \todo -////////////////////////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////////////////////////// -// File name : version.h -// Module : Communication -// Description : TODO INSERT -// Scope : < example:Legacy Architecture> -// Platform : _CWORD3_002 Platform -// -// Customer : -// System : -// Reference : -////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_VERSION_H_ -#define COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_VERSION_H_ - -#define MAJORNO 0x01 -#define MINORNO 0x00 -#define REVISION 0x00 - -#endif // COMMUNICATION_SERVER_INCLUDE_MAIN_COMMUNICATION_VERSION_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication.h b/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication.h deleted file mode 100755 index 94f5544..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// @copyright Copyright (c) 2017-2020 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 communication.h - * @~english - * @brief communication unit header - */ - -#ifndef PERIPHERALSERVICE_COMMUNICATION_H_ // NOLINT(build/header_guard) -#define PERIPHERALSERVICE_COMMUNICATION_H_ // NOLINT(build/header_guard) - -#include <peripheral_service/communication_notifications.h> -#include <peripheral_service/communication_can.h> - -#endif // PERIPHERALSERVICE_COMMUNICATION_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication_notifications.h b/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication_notifications.h deleted file mode 100755 index 9c207f3..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/peripheral_service/communication_notifications.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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 communication_notifications.h - * @~english - * @brief Defination of communication notification - */ - -#ifndef COMMUNICATION_SERVER_INCLUDE_PERIPHERAL_SERVICE_COMMUNICATION_NOTIFICATIONS_H_ -#define COMMUNICATION_SERVER_INCLUDE_PERIPHERAL_SERVICE_COMMUNICATION_NOTIFICATIONS_H_ - -/*! @~english Defination of communication notification */ -#define NTFY_Communication_Availability "Communication/Availability" - -#endif // COMMUNICATION_SERVER_INCLUDE_PERIPHERAL_SERVICE_COMMUNICATION_NOTIFICATIONS_H_ diff --git a/video_in_hal/peripheralservice/communication/server/include/peripheral_service/ps_services.h b/video_in_hal/peripheralservice/communication/server/include/peripheral_service/ps_services.h deleted file mode 100755 index fd556d6..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/peripheral_service/ps_services.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * @copyright Copyright (c) 2017-2020 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 ps_services.h - * @~english - * @brief Defines the names of the available peripheral services. - */ - -#ifndef PERIPHERALSERVICE__CWORD121_SHADOW_CLIENT_INCLUDE_PERIPHERAL_SERVICE_PS_SERVICES_H_ // NOLINT(build/header_guard) -#define PERIPHERALSERVICE__CWORD121_SHADOW_CLIENT_INCLUDE_PERIPHERAL_SERVICE_PS_SERVICES_H_ // NOLINT(build/header_guard) - -/** - * @file ps_services.h - */ -/** @addtogroup BaseSystem - * @{ - */ -/** @addtogroup peripheral_service - * @ingroup BaseSystem - * @{ - */ - -/*------------------------------------------------------------------------------ - * define - *----------------------------------------------------------------------------*/ -#define SERVICE_PSMSHADOW "PS_PSMShadow" -/*!< @~english Define the name of SERVICE_PSMSHADOW */ - -#define SERVICE_IPC "PS_IPC_DISP" -/*!< @~english Define the name of SERVICE_IPC */ - -#define SERVICE_IPC_DISP "PS_IPC" -/*!< @~english Define the name of SERVICE_IPC_DISP */ - -#define SERVICE_IPCTESTAPP "PS_IPC_TestApp" -/*!< @~english Define the name of SERVICE_IPCTESTAPP */ - -#define SERVICE_HMIKEYHANDLER "PS_KeyHandler" -/*!< @~english PS_KeyHandler name SERVICE_HMIKEYHANDLER */ - -#define SERVICE_MP_SHADOW "PS_IPC_MP_Shadow" -/*!< @~english Define the name of SERVICE_MP_SHADOW */ - -#define SERVICE_SENSORSHADOW "PS_SensorShadow" -/*!< @~english Define the name of SERVICE_SENSORSHADOW */ - -#define SERVICE_COMMUNICATIONDEBUGDUMPTEST "PS_COMMUNICATIONDebugDumpTest" -/*!< @~english Define the name of SERVICE_COMMUNICATIONDEBUGDUMPTEST */ - -#define SERVICE_PSMSHADOWTEST "PS_TEST_PSMShadow" -/*!< @~english Define the name of SERVICE_PSMSHADOWTEST */ - -#define SERVICE_LOGGERSHADOW "PS_LoggerShadow" -/*!< @~english Define the name of SERVICE_LOGGERSHADOW */ - -#define SERVICE_SOFTWAREUPDATESHADOW "PS_SoftwareUpdateShadow" -/*!< @~english Define the name of SERVICE_SOFTWAREUPDATESHADOW */ - -// #define SERVICE_LINSHADOW "LINShadowService" -///*!< @~english Define the name of SERVICE_LINSHADOW */ - -// #define SERVICE_RTCSHADOW "RTCShadowService" -///*!< @~english Define the name of SERVICE_RTCSHADOW */ - -// #define SERVICE_HBSHADOW "HBShadowService" -///*!< @~english Define the name of SERVICE_HBSHADOW */ - -// #define SERVICE_HBDUMMY "HBDummyService" -///*!< @~english Define the name of SERVICE_HBDUMMY */ - -// #define SERVICE_DISPLAYSHADOW "DisplayShadowService" -///*!< @~english Define the name of SERVICE_DISPLAYSHADOW */ - -// #define SERVICE_HMIALDUMMY "HMIALDummyService" -///*!< @~english Define the name of SERVICE_HMIALDUMMY */ - -/** @}*/ // end of peripheral_service -/** @}*/ // end of BaseSystem - -#endif // PERIPHERALSERVICE__CWORD121_SHADOW_CLIENT_INCLUDE_PERIPHERAL_SERVICE_PS_SERVICES_H_ // NOLINT(build/header_guard) diff --git a/video_in_hal/peripheralservice/communication/server/include/threads/CAN_Thread.h b/video_in_hal/peripheralservice/communication/server/include/threads/CAN_Thread.h deleted file mode 100755 index b6960ef..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/threads/CAN_Thread.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#ifndef COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_ -#define COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_ -#include <peripheral_service/Canif_API.h> -#include <stdlib.h> - -#include "com_error_type.h" -#include "communication_communicationlog.h" - -#if 0 -#define CAN_TX_COMMAND_SIZE (CAN_TRX_HEADER_SIZE + CAN_TX_OPERAND_SIZE) - -#define CAN_RX_CANDATA_SIZE CAN_DATA_SIZE /* Receive CANData(DATA#1 ~ #x)size */ -/* Reserve the structure if it is not a multiple of 4. */ -#define CAN_TX_CANDATA_SIZE CAN_DATA_SIZE /* Send CANData(DATA#1 ~ #x)size */ -/* Reserve the structure if it is not a multiple of 4. */ -#define CAN_RX_OPERAND_SIZE (CAN_TRX_CANID_SIZE + CAN_TRX_DLC_SIZE + CAN_RX_CANDATA_SIZE) -#define CAN_TX_OPERAND_SIZE (CAN_TRX_CANID_SIZE + CAN_TRX_DLC_SIZE + CAN_TX_CANDATA_SIZE) // NOLINT(whitespace/line_length) -/* Send operand size */ - -#endif - -#define CAN_CMDSND_DATA_SIZE 0 /* Command transmission data section size (CAN command control) */ - -#define CAN_TX_CMD_DELIVERY_SIZE 4 /* Transmitting CAN Command Delivery Data Size Common Block */ -#define CAN_TX_CMD_FUELCALC_RST_SIZE 0 /* Transmit CAN Command Delivery Data Size CAN Section Burn Cost Reset Request Receive Data */ -#define CAN_TX_CMD_STARTUP_FIN_SIZE 3 /* Transmit CAN Command Delivery Data Size CAN Startup Completion Notification Data */ -#define CAN_TX_CMD_MRST_INFO_SIZE 33 /* Transmit CAN Command Delivery Data Size CAN Master Reset Information Notification Receive Data */ -#define CAN_TX_CMD_VERSION_SIZE 4 /* Transmit CAN Command Delivery Data Size CAN Version Response Receive Data */ - -#define CAN_TRX_HEADER_SIZE 7 /* Size of send/receive header section (data length excluding operands) */ -#define CAN_TRX_CANID_SIZE 4 /* Transmit/Receive CAN ID Size */ -#define CAN_TRX_DLC_SIZE 1 /* Transmit/Receive DLC Data Size */ -typedef CANIF_RET_API RET_CAN; -EFrameworkunifiedStatus CANCallbackForTimeOut(HANDLE); -#endif // COMMUNICATION_SERVER_INCLUDE_THREADS_CAN_THREAD_H_
\ No newline at end of file diff --git a/video_in_hal/peripheralservice/communication/server/include/threads/Thread_Common.h b/video_in_hal/peripheralservice/communication/server/include/threads/Thread_Common.h deleted file mode 100755 index 6cda5aa..0000000 --- a/video_in_hal/peripheralservice/communication/server/include/threads/Thread_Common.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * @copyright Copyright (c) 2019-2020 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. - */ -#ifndef COMMUNICATION_SERVER_INCLUDE_THREADS_THREAD_COMMON_H_ -#define COMMUNICATION_SERVER_INCLUDE_THREADS_THREAD_COMMON_H_ -#include <stdint.h> -#include <can_hal.h> -#include <string> -#include <sstream> -#include <iostream> - -const int32_t CAN_AVAILABILITY = 0x1; - -void CommonInit(void); -HANDLE CommonFindSender(HANDLE h_app, std::string s); -BOOL CommGetAvailabilityCurrent(int32_t current); -void CommSetAvailabilityCurrent(int32_t current); -void CommClrAvailabilityCurrent(int32_t current); -EFrameworkunifiedStatus CommonStartNotify(HANDLE h_app, PCSTR cmd); -EFrameworkunifiedStatus CommonThreadStart(HANDLE h_app, const FrameworkunifiedProtocolCallbackHandler *cb, - UI_32 count, PCSTR cmd, EFrameworkunifiedStatus (*open_func)(HANDLE)); -EFrameworkunifiedStatus CommonThreadStop(HANDLE h_app, const PUI_32 cb, UI_32 count, - PCSTR cmd, EFrameworkunifiedStatus (*close_func)(HANDLE)); -EFrameworkunifiedStatus CommonCanHalErrorNotify(HANDLE h_app); - -static inline EFrameworkunifiedStatus ConvRet(CANHAL_RET_API ret) { - return ((ret != CANHAL_RET_NORMAL) ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK); -} -std::string MessageDataOutputLog(uint8_t *msg_data, uint32_t len); -#endif
\ No newline at end of file diff --git a/video_in_hal/peripheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp b/video_in_hal/peripheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp deleted file mode 100755 index 2ece107..0000000 --- a/video_in_hal/peripheralservice/communication/server/src/CAN/CommWatch/CAN_CommWatch.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#include "CAN_CommWatch.h" - -#include <native_service/frameworkunified_types.h> -#include <native_service/frameworkunified_framework_if.h> -#include <peripheral_service/Canif_API.h> -#include <utility> -#include <map> -#include <string> -#include "CAN_Thread.h" -#include "Thread_Common.h" - -static CAN_CommWatchTable g_map_comm_watch_list_can; - -void CANCommWatchInit(void) { - g_map_comm_watch_list_can.clear(); - return; -} - -static CAN_CommWatchTableIt CANCommWatchFind(CANID k, CAN_COMM_WATCH_VAL *val) { - std::pair<CAN_CommWatchTableIt, CAN_CommWatchTableIt> range; - CAN_CommWatchTableIt it; - bool found = false; - - range = g_map_comm_watch_list_can.equal_range(k); - for (it = range.first; it != range.second; it++) { - if (!memcmp(&(it->second.notify_name), - val->notify_name, sizeof(val->notify_name))) { - found = true; - break; - } - } - - if (!found) - it = g_map_comm_watch_list_can.end(); - - return it; -} - -static bool CANCommWatchInsert(CANID k, CAN_COMM_WATCH_VAL *val) { - CAN_CommWatchTableIt it = CANCommWatchFind(k, val); - CAN_CommWatchTablePair p = std::make_pair((const CANID)k, *val); - bool inserted = false; - - if (it == g_map_comm_watch_list_can.end()) { - g_map_comm_watch_list_can.insert(p); - inserted = true; - } - return inserted; -} - -static void CANCommWatchUpdate(HANDLE h_app, CANID key, - CAN_COMM_WATCH_VAL *val) { - if (CANCommWatchInsert(key, val)) { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch : " - "Entry (CANID=%x, DataID=%x, dst=%s, time=%d, cnt=%lu)", - key, val->data_id, - val->notify_name, val->set_time, - g_map_comm_watch_list_can.size()); - } else { - CAN_CommWatchTableIt it = CANCommWatchFind(key, val); - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch : Update the time " - "(CANID=%x, DataID=%x, dst=%s, time:%d -> %d, cnt =%lu)", - key, val->data_id, val->notify_name, - it->second.set_time, val->set_time, - g_map_comm_watch_list_can.size()); - it->second.comm_watch_flag = val->comm_watch_flag; - it->second.set_time = val->set_time; - it->second.timer_cnt = val->timer_cnt; - it->second.data_id = val->data_id; - } - - return; -} - -static void CANCommWatchStop(HANDLE h_app, CANID key, - CAN_COMM_WATCH_VAL *val) { - CAN_CommWatchTableIt it = CANCommWatchFind(key, val); - if (it != g_map_comm_watch_list_can.end()) { - g_map_comm_watch_list_can.erase(it); - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch : Stop the commwatch" - "(CANID=%x, dst=%s, cnt=%lu)", - key, val->notify_name, g_map_comm_watch_list_can.size()); - } - - return; -} - -EFrameworkunifiedStatus CANCommWatch(HANDLE h_app) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanCommWatch"); - - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - CAN_COMM_WATCHEXT_MSG_DAT rcv_msg; - CANID key; - CAN_COMM_WATCH_VAL val; - CAN_CommWatchTableIt it; - - memset(&rcv_msg, 0, sizeof(rcv_msg)); - memset(&val, 0, sizeof(val)); - e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status); - if (e_status == eFrameworkunifiedStatusInvldBufSize) { - FrameworkunifiedClearMsgData(h_app); - } - goto cleanup; - } - - // Create search data - key = rcv_msg.ulCanid; - snprintf(val.notify_name, sizeof(val.notify_name), "%s", rcv_msg.notifyName); - val.data_id = rcv_msg.ulDid; - val.comm_watch_flag = CAN_COMM_NORMAL; - val.set_time = rcv_msg.usWatchTime; - val.timer_cnt = rcv_msg.usWatchTime; - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, - "CAN CommWatch : dst=%s, CANID=%x, dataID=%x, time=%d", - rcv_msg.notifyName, - rcv_msg.ulCanid, - rcv_msg.ulDid, rcv_msg.usWatchTime); - - if (0 == rcv_msg.usWatchTime) { - CANCommWatchStop(h_app, key, &val); - } else { - CANCommWatchUpdate(h_app, key, &val); - } - e_status = eFrameworkunifiedStatusOK; -cleanup: - return e_status; -} - -static EFrameworkunifiedStatus CANCommWatchSndMsg(HANDLE h_app, - CAN_COMM_WATCH_VAL *v, uint32_t cid) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - CAN_MSG_COMM_WATCHSTS msg; - HANDLE h_client = NULL; - - memset(&msg, 0, sizeof(msg)); - msg.hdr.hdr.cid = (uint16_t)cid; - msg.hdr.hdr.msgbodysize = sizeof(CAN_MSG_COMM_WATCHSTS_DAT); - msg.hdr.hdr.rid = 0; - msg.data.ulDid = v->data_id; - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%x ulDid=%x", - msg.hdr.hdr.cid, msg.hdr.hdr.msgbodysize, msg.data.ulDid); - - h_client = CommonFindSender(h_app, v->notify_name); - if (!h_client){ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CommonFindSender failed"); - goto cleanup; - } - - e_status = FrameworkunifiedSendMsg(h_client, cid, sizeof(msg), &msg); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, - "FrameworkunifiedSendMSg Error(e_status:%d to %s)", - e_status, v->notify_name); - goto cleanup; - } - - e_status = eFrameworkunifiedStatusOK; -cleanup: - return e_status; -} - -static void CANCommWatchTimeoutCore(HANDLE h_app, CAN_COMM_WATCH_VAL *v) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - - if (CAN_COMM_NORMAL != v->comm_watch_flag) - return; - - if (v->timer_cnt != 0) - v->timer_cnt--; - - if (v->timer_cnt != 0) - return; - - e_status = CANCommWatchSndMsg(h_app, v, CID_CAN_COMM_STOP); - if (eFrameworkunifiedStatusOK == e_status) { - v->comm_watch_flag = CAN_COMM_STOP; - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CANCommWatchSndMsg failed"); - // retry at next timeout. - } -} - -EFrameworkunifiedStatus CANCommWatchTimeout(HANDLE h_app) { - CAN_CommWatchTableIt it; - - for (it = g_map_comm_watch_list_can.begin(); - it != g_map_comm_watch_list_can.end(); it++) { - CANCommWatchTimeoutCore(h_app, &(it->second)); - } - - return eFrameworkunifiedStatusOK; -} - -static void CANCommWatchClearCore(HANDLE h_app, CANID id, - CAN_COMM_WATCH_VAL *v) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - - v->timer_cnt = v->set_time; - - if (CAN_COMM_STOP != v->comm_watch_flag) - return; - - e_status = CANCommWatchSndMsg(h_app, v, CID_CAN_COMM_RESTORE); - if (eFrameworkunifiedStatusOK == e_status) { - v->comm_watch_flag = CAN_COMM_NORMAL; - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "Can CommWatch Clear : CANID=%x", id); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CANCommWatchSndMsg failed"); - // retry at next timeout. - } -} - -void CANCommWatchClear(HANDLE h_app, CANID id) { - std::pair<CAN_CommWatchTableIt, CAN_CommWatchTableIt> range; - CAN_CommWatchTableIt it; - - range = g_map_comm_watch_list_can.equal_range(id); - for (it = range.first; it != range.second; it++) { - CANCommWatchClearCore(h_app, id, &(it->second)); - } -} diff --git a/video_in_hal/peripheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp b/video_in_hal/peripheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp deleted file mode 100755 index b991431..0000000 --- a/video_in_hal/peripheralservice/communication/server/src/CAN/Delivery/CAN_Delivery.cpp +++ /dev/null @@ -1,405 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#include "CAN_Delivery.h" - -#include <can_hal.h> -#include <native_service/frameworkunified_framework_if.h> -#include <peripheral_service/Canif_API.h> -#include <can_hal.h> -#include <utility> -#include <map> -#include <string> -#include "CAN_TxMsg.h" -#include "CAN_CommWatch.h" -#include "Canif_API_Local.h" -#include "API_Local_Common.h" -#include "Thread_Common.h" - -static CAN_DeliveryEntryList g_map_delivery_list_can; -// Member of g_msg_rx_msg exist as long as communication exists. -static std::map<CANID, CanMessage *> g_can_rx_msg; - -void CANDeliveryInit(void) { - g_map_delivery_list_can.clear(); - return; -} - -static CanMessage *CANMsgFind(CANID k) { - std::map<CANID, CanMessage *>::iterator it; - - it = g_can_rx_msg.find(k); - if (it == g_can_rx_msg.end()) - return NULL; - return it->second; -} - -static void CANMsgInsert(CANID k, CanMessage *msg) { - CanMessage *latest = CANMsgFind(k); - if (!latest) { - latest = new CanMessage(); - } - g_can_rx_msg[k] = latest; - memcpy(latest, msg, sizeof(CanMessage)); -} - -static CAN_DeliveryEntryListIt CANDeliveryFind(CANID canid, std::string s) { - std::pair<CAN_DeliveryEntryListIt, CAN_DeliveryEntryListIt> range; - CAN_DeliveryEntryListPair p = std::make_pair(canid, s); - CAN_DeliveryEntryListIt it; - bool found = false; - range = g_map_delivery_list_can.equal_range(canid); - for (it = range.first; it != range.second; ++it) { - if (*it == p) { - found = true; - break; - } - } - - if (!found) - it = g_map_delivery_list_can.end(); - - return it; -} - -bool CANDeliveryInsert(CANID canid, std::string s) { - CAN_DeliveryEntryListIt it = CANDeliveryFind(canid, s); - CAN_DeliveryEntryListPair p = std::make_pair(canid, s); - bool inserted = false; - - if (it == g_map_delivery_list_can.end()) { - g_map_delivery_list_can.insert(p); - inserted = true; - } - - return inserted; -} - -static EFrameworkunifiedStatus CANDeliverySndCmdSingle(HANDLE h_app, CANID cmd, - CanMessage *msg, std::string dest) { - CAN_MSG_CANCMD st_delivery_msg; - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - HANDLE h_client; - uint16_t len = 0; - - // Create delivery data - memset(&st_delivery_msg, 0, sizeof(st_delivery_msg)); - switch (cmd) { - case CAN_CMDID_FUELCALC_RST_REQ_RX: - len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_FUELCALC_RST_SIZE; - break; - case CAN_CMDID_STARTUP_FIN_RESP_RX: - len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_STARTUP_FIN_SIZE; - break; - case CAN_CMDID_MRST_INFO_RESP_RX: - len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_MRST_INFO_SIZE; - break; - case CAN_CMDID_VERSION_RESP_RX: - len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_VERSION_SIZE; - break; - case CAN_CMDID_CONNECTION_NODE_RESP_RX: - len = (uint16_t)(CAN_TX_CMD_DELIVERY_SIZE + msg->data[0] + 1); - break; - default: - return e_status; - } - st_delivery_msg.hdr.hdr.rid = 0; - st_delivery_msg.hdr.hdr.cid = (uint16_t)CID_CAN_CMD_DELIVERY; - st_delivery_msg.hdr.hdr.msgbodysize = len; - st_delivery_msg.data.cmd_id = (uint8_t)cmd; - memcpy(&st_delivery_msg.data.data, msg->data, - (size_t)(len - CAN_TX_CMD_DELIVERY_SIZE)); - - h_client = CommonFindSender(h_app, dest); - if (!h_client) { - return e_status; - } - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%x cmd_id=%x", - st_delivery_msg.hdr.hdr.cid, st_delivery_msg.hdr.hdr.msgbodysize, - st_delivery_msg.data.cmd_id); - FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s", - MessageDataOutputLog(st_delivery_msg.data.data, len).c_str()); - - e_status = FrameworkunifiedSendMsg(h_client, CID_CAN_CMD_DELIVERY, - sizeof(st_delivery_msg), &st_delivery_msg); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)", - e_status, dest.c_str()); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, - "CAN Delivery : dst = %s, CMD = %x, DLC = %x", - dest.c_str(), cmd, msg->dlc); - } - return e_status; -} - -static EFrameworkunifiedStatus CANDeliverySndMsgSingle(HANDLE h_app, CANID ul_canid, - uint8_t uc_dlc, const uint8_t *puc_data, - enum CanIfEchoBackFlags flag, std::string dest) { - CAN_MSG_CANDATA st_delivery_msg; - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - HANDLE h_client; - uint8_t uc_size = uc_dlc; - - // Create delivery data - memset(&st_delivery_msg, 0, sizeof(st_delivery_msg)); - st_delivery_msg.hdr.hdr.cid = CID_CAN_DATA_DELIVERY; - st_delivery_msg.hdr.hdr.msgbodysize = (uint16_t)(CAN_TRX_CANID_SIZE + - CAN_TRX_DLC_SIZE + - (uint32_t)uc_size); - st_delivery_msg.hdr.hdr.rid = 0; - st_delivery_msg.data.can_id = ul_canid; - st_delivery_msg.data.dlc = uc_size; - st_delivery_msg.echoback = flag; - if (uc_size > (uint8_t)CAN_DATA_SIZE) - uc_size = CAN_DATA_SIZE; - memcpy(st_delivery_msg.data.data, puc_data, (size_t)uc_size); - - h_client = CommonFindSender(h_app, dest); - if (!h_client) { - return e_status; - } - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "can_id=%x dlc=%x echoback=%d", - st_delivery_msg.data.can_id, st_delivery_msg.data.dlc, - st_delivery_msg.echoback); - FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s", - MessageDataOutputLog(st_delivery_msg.data.data, uc_size).c_str()); - - e_status = FrameworkunifiedSendMsg(h_client, CID_CAN_DATA_DELIVERY, - sizeof(st_delivery_msg), &st_delivery_msg); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)", - e_status, dest.c_str()); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, - "CAN Delivery : dst = %s, CANID = %x, DLC = %x", - dest.c_str(), ul_canid, uc_dlc); - } - return e_status; -} - -EFrameworkunifiedStatus CANDeliveryEntry(HANDLE h_app) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanRecv"); - - uint16_t i; - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - CAN_DELIVERY_ENTRY rcv_msg; - CAN_DeliveryEntryListIt it; - bool fail = false; - - memset(&rcv_msg, 0, sizeof(rcv_msg)); - e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, - sizeof(rcv_msg), eSMRRelease); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, - "CAN DeliveryEntry FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status); - if (e_status == eFrameworkunifiedStatusInvldBufSize) { - FrameworkunifiedClearMsgData(h_app); - } - goto cleanup; - } - - for (i = 0; i < rcv_msg.usCanNum; i++) { - CANID canid = rcv_msg.ulCanid[i]; - CanMessage *latest = CANMsgFind(canid); - - if (CANDeliveryInsert(canid, rcv_msg.notifyName)) { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "(cnd:%lu) : CANID=0x%x, dst=%s", - g_map_delivery_list_can.size(), canid, rcv_msg.notifyName); - } - - if (latest) { - switch (canid) { - case CAN_CMDID_FUELCALC_RST_REQ_RX: - case CAN_CMDID_STARTUP_FIN_RESP_RX: - case CAN_CMDID_MRST_INFO_RESP_RX: - case CAN_CMDID_VERSION_RESP_RX: - case CAN_CMDID_CONNECTION_NODE_RESP_RX: - if (eFrameworkunifiedStatusOK != CANDeliverySndCmdSingle(h_app, canid, - latest, rcv_msg.notifyName)) { - fail = true; - } - break; - default: - if (eFrameworkunifiedStatusOK != CANDeliverySndMsgSingle(h_app, canid, - static_cast<uint8_t>(latest->dlc), - latest->data, CANIF_PURERECV, rcv_msg.notifyName)) { - fail = true; - } - break; - } - } - } - - if (fail) - e_status = eFrameworkunifiedStatusFail; - -cleanup: - return e_status; -} - -static EFrameworkunifiedStatus CANDeliverySndMsgToClient(HANDLE h_app, CANID ul_canid, - void *data, size_t size, PS_CommunicationProtocol cid) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - HANDLE h_client = NULL; - CAN_DeliveryEntryListIt it; - std::pair<CAN_DeliveryEntryListIt, CAN_DeliveryEntryListIt> range; - bool fail = false; - - it = g_map_delivery_list_can.find(ul_canid); - range = g_map_delivery_list_can.equal_range(ul_canid); - for (it = range.first; it != range.second; ++it) { - h_client = CommonFindSender(h_app, it->second); - if (!h_client) { - continue; - } - - e_status = FrameworkunifiedSendMsg(h_client, cid, (UI_32)size, data); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)", - e_status, it->second.c_str()); - fail = true; - } - } - return fail ? eFrameworkunifiedStatusFail : eFrameworkunifiedStatusOK; -} - -EFrameworkunifiedStatus CANDeliverySndMsg(HANDLE h_app, CANID ul_canid, uint8_t n_ta, - uint8_t uc_dlc, const uint8_t *puc_data, - PS_CommunicationProtocol cid, enum CanIfEchoBackFlags flag) { - CAN_MSG_CANDATA st_delivery_msg; - uint8_t uc_size = uc_dlc; - - // Create delivery data - memset(&st_delivery_msg, 0, sizeof(st_delivery_msg)); - st_delivery_msg.hdr.hdr.cid = cid; - st_delivery_msg.hdr.hdr.msgbodysize = (uint16_t)(CAN_TRX_CANID_SIZE + - CAN_TRX_DLC_SIZE + - (uint32_t)uc_size); - st_delivery_msg.hdr.hdr.rid = 0; - st_delivery_msg.data.can_id = ul_canid; - st_delivery_msg.data.dlc = uc_size; - st_delivery_msg.echoback = flag; - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "can_id=%x dlc=%x echoback=%d", - st_delivery_msg.data.can_id, st_delivery_msg.data.dlc, - st_delivery_msg.echoback); - FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s", - MessageDataOutputLog(st_delivery_msg.data.data, uc_size).c_str()); - - - if (uc_size > (uint8_t)CAN_DATA_SIZE) - uc_size = CAN_DATA_SIZE; - memcpy(st_delivery_msg.data.data, puc_data, (size_t)uc_size); - - return CANDeliverySndMsgToClient(h_app, ul_canid, &st_delivery_msg, - sizeof(st_delivery_msg), cid); -} - -EFrameworkunifiedStatus CANCommandDeliveryRcvProcess(HANDLE h_app, - CanMessage *msg, uint8_t cmd) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - CAN_MSG_CANCMD st_delivery_msg; - uint16_t len = 0; - - memset(&st_delivery_msg, 0, sizeof(st_delivery_msg)); - switch (cmd) { - case CAN_CMDID_FUELCALC_RST_REQ_RX: - len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_FUELCALC_RST_SIZE; - break; - case CAN_CMDID_STARTUP_FIN_RESP_RX: - len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_STARTUP_FIN_SIZE; - break; - case CAN_CMDID_MRST_INFO_RESP_RX: - len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_MRST_INFO_SIZE; - break; - case CAN_CMDID_VERSION_RESP_RX: - len = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_VERSION_SIZE; - break; - case CAN_CMDID_CONNECTION_NODE_RESP_RX: - len = (uint16_t)(CAN_TX_CMD_DELIVERY_SIZE + msg->data[0] + 1); - break; - default: - return e_status; - } - st_delivery_msg.hdr.hdr.rid = 0; - st_delivery_msg.hdr.hdr.cid = (uint16_t)CID_CAN_CMD_DELIVERY; - st_delivery_msg.hdr.hdr.msgbodysize = len; - st_delivery_msg.data.cmd_id = cmd; - memcpy(&st_delivery_msg.data.data, msg->data, - (size_t)(len - CAN_TX_CMD_DELIVERY_SIZE)); - CANMsgInsert(cmd, msg); - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%x cmd_id=%x", - st_delivery_msg.hdr.hdr.cid, st_delivery_msg.hdr.hdr.msgbodysize, - st_delivery_msg.data.cmd_id); - FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s", - MessageDataOutputLog(st_delivery_msg.data.data, len).c_str()); - - return CANDeliverySndMsgToClient(h_app, msg->can_id, &st_delivery_msg, - sizeof(st_delivery_msg), CID_CAN_CMD_DELIVERY); -} - -EFrameworkunifiedStatus CANDeliveryRcvProcess(HANDLE h_app, CanMessage *msg) { - if (!Canif_CheckCanID(msg->can_id)) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CANID is invalid (%x)", msg->can_id); - return eFrameworkunifiedStatusFail; - } - - CANCommWatchClear(h_app, msg->can_id); - CANMsgInsert(msg->can_id, msg); - if (eFrameworkunifiedStatusOK != CANDeliverySndMsg(h_app, msg->can_id, CAN_NTA_INVALID, - (uint8_t)msg->dlc, msg->data, CID_CAN_DATA_DELIVERY)) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "CAN Delivery Error"); - return eFrameworkunifiedStatusFail; - } - - return eFrameworkunifiedStatusOK; -} - -EFrameworkunifiedStatus CANClearEntry(HANDLE h_app) { - char notify_name[CANIF_NOTIFY_NAME_MAX_SIZE + 1] = {0}; - CAN_DeliveryEntryListIt it; - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - - e_status = FrameworkunifiedGetMsgDataOfSize(h_app, ¬ify_name, - CANIF_NOTIFY_NAME_MAX_SIZE, eSMRRelease); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, - "#CAN thread# FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status); - if (e_status == eFrameworkunifiedStatusInvldBufSize) { - FrameworkunifiedClearMsgData(h_app); - } - return e_status; - } - - FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "notify_name=%s", notify_name); - - // To avoid destruction of iterator. - it = g_map_delivery_list_can.begin(); - while (it != g_map_delivery_list_can.end()) { - size_t n = strnlen(it->second.c_str(), CANIF_NOTIFY_NAME_MAX_SIZE); - if (!strncmp(it->second.c_str(), notify_name, n)) { - g_map_delivery_list_can.erase(it++); - } else { - ++it; - } - } - - return eFrameworkunifiedStatusOK; -} diff --git a/video_in_hal/peripheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp b/video_in_hal/peripheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp deleted file mode 100755 index fa5d61d..0000000 --- a/video_in_hal/peripheralservice/communication/server/src/CAN/TxMsg/CAN_TxMsg.cpp +++ /dev/null @@ -1,416 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ -#include "CAN_TxMsg.h" -#include "CAN_Delivery.h" -#include <string.h> -#include <native_service/frameworkunified_types.h> -#include <native_service/frameworkunified_framework_if.h> -#include <peripheral_service/Canif_API.h> -#include <can_hal.h> -#include <map> -#include <string> -#include "CAN_Thread.h" -#include "Thread_Common.h" -#include "Canif_API_Local.h" -#include "CAN_TxMsg.h" -#include "Canif_TransmissionData.h" - -static std::map<CANID, CAN_SEND_STATUS_DAT> g_m_send_sts; -static bool can_cmd_rst_rcv = false; -static std::map<CANID, CAN_TRANS_START_TABLE_VAL *> g_map_trans_data; - -void CANTxMsgInit(void) { - g_m_send_sts.clear(); - uint32_t i; - - for (i = 0; i < _countof(Can_TransInitData_21PF); i++) { - CANID canid = Can_TransInitData_21PF[i].canid; - CAN_TRANS_START_TABLE_VAL *val = &(Can_TransInitData_21PF[i].val); - g_map_trans_data[canid] = val; - } - - return; -} - -static bool CANCommandFuelCalcRstReqCheck(void) { - return can_cmd_rst_rcv; -} - -void CANCommandSetFuelCalcRstReq(void) { - can_cmd_rst_rcv = true; -} - -static void CANTxMsgErrorLog(const char *reason, const char *func, - CANID id, uint16_t len, HANDLE h_app) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, func, "%s Frame(0x%x) length=%hu from %s is ignored.", - reason, id, len, FrameworkunifiedGetMsgSrc(h_app)); -} - -static EFrameworkunifiedStatus CANCommandResponse(HANDLE h_app, CAN_MSG_CANCMD *msg, - size_t len, char *notifyName) { - HANDLE h_client = NULL; - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - - h_client = CommonFindSender(h_app, notifyName); - if (!h_client) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Cannot open sender handle."); - return e_status; - } - - msg->hdr.hdr.cid = (uint16_t)CID_CAN_CMD_DELIVERY; - e_status = FrameworkunifiedSendMsg(h_client, CID_CAN_CMD_DELIVERY, (uint32_t)len, msg); - if (e_status != eFrameworkunifiedStatusOK) - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg is failed."); - - return e_status; -} - -static EFrameworkunifiedStatus CANCommandVersionReq(HANDLE h_app, char *notifyName) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - CANHAL_RET_API ret = CANHAL_RET_NORMAL; - std::string version_info; - CAN_MSG_CANCMD msg; - - memset(&msg, 0, sizeof(msg)); - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "@@@ Call CanGetVersion for can_hal"); - ret = CanGetVersion(h_app, &version_info); - if (ret != CANHAL_RET_NORMAL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Cannot get version from can_hal."); - return e_status; - } - - if (CAN_TX_CMD_VERSION_SIZE != version_info.length()) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "Invalid length of version."); - return e_status; - } - - msg.hdr.hdr.rid = 0; - msg.hdr.hdr.msgbodysize = CAN_TX_CMD_DELIVERY_SIZE + CAN_TX_CMD_VERSION_SIZE; - msg.data.cmd_id = CAN_CMDID_VERSION_RESP_RX; - strncpy((char *)msg.data.data, version_info.c_str(), CAN_TX_CMD_VERSION_SIZE); - return CANCommandResponse(h_app, &msg, sizeof(msg), notifyName); -} - -static EFrameworkunifiedStatus CANCommandFuelcalcRstReq(HANDLE h_app, char *notifyName) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - if (CANCommandFuelCalcRstReqCheck()) { - // CAN_CMDID_FUELCALC_RST_REQ_RX is already received from can_hal. - // so response it in direct. - CAN_MSG_CANCMD msg; - memset(&msg, 0, sizeof(msg)); - msg.hdr.hdr.rid = 0; - msg.hdr.hdr.msgbodysize = CAN_TX_CMD_DELIVERY_SIZE + - CAN_TX_CMD_FUELCALC_RST_SIZE; - msg.data.cmd_id = CAN_CMDID_FUELCALC_RST_REQ_RX; - e_status = CANCommandResponse(h_app, &msg, sizeof(msg), notifyName); - } else { - CANDeliveryInsert(CAN_CMDID_FUELCALC_RST_REQ_RX, notifyName); - e_status = eFrameworkunifiedStatusOK; - } - return e_status; -} - -static EFrameworkunifiedStatus CANCommandOther(HANDLE h_app, char *notifyName, - uint8_t cmd, uint8_t rid) { - CanMessage msg; - CANID wait = 0; - CANID can_id = (CANID)cmd; - - memset(&msg, 0, sizeof(msg)); - switch (cmd) { - case CAN_CMDID_STARTUP_FIN_REQ_TX: - wait = CAN_CMDID_STARTUP_FIN_RESP_RX; - break; - case CAN_CMDID_MRST_INFO_REQ_TX: - wait = CAN_CMDID_MRST_INFO_RESP_RX; - break; - case CAN_CMDID_CONNECTION_NODE_REQ_TX: - wait = CAN_CMDID_CONNECTION_NODE_RESP_RX; - break; - case CAN_CMDID_FUELCALC_REQ_TX: - wait = CAN_CMDID_FUELCALC_RST_REQ_RX; - break; - default: - CANTxMsgErrorLog("Unsupported cmd requested", __func__, cmd, 0, h_app); - return eFrameworkunifiedStatusFail; - } - - if (cmd != CAN_CMDID_FUELCALC_REQ_TX) { - CANDeliveryInsert(wait, notifyName); - } - - if (rid != CAN_RID_NOTUSE_CODE) { - // cmd can be assumed same as can_id. - if (0 < g_m_send_sts.count(can_id)) { - if (g_m_send_sts[can_id].notify_name[0] != 0x00) { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, - "Not yet deliver SendSts but updated(SendID=%x, CAN ID=%x, Nane=%s)", - g_m_send_sts[can_id].rid, can_id, g_m_send_sts[can_id].notify_name); - } - } - g_m_send_sts[can_id].rid = rid; - memcpy(g_m_send_sts[can_id].notify_name, notifyName, - sizeof(g_m_send_sts[can_id].notify_name)); - } - - msg.can_id = (CANID)cmd; - msg.rid = rid; - msg.dlc = (uint8_t)CAN_CMDSND_DATA_SIZE; - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "@@@ Call CanSend for can_hal"); - if (CANHAL_RET_NORMAL != CanSend(h_app, &msg, CAN_HAL_TYPE_CAN)) { - CANTxMsgErrorLog("CAN CanSend failed", __func__, msg.can_id, - (uint16_t)msg.dlc, h_app); - return eFrameworkunifiedStatusFail; - } - - return eFrameworkunifiedStatusOK; -} - -EFrameworkunifiedStatus CANTxMsgCommand(HANDLE h_app) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanCommandCtl"); - - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - CAN_CMD_CTRL_MSG_DAT rcv_msg; - - memset(&rcv_msg, 0, sizeof(rcv_msg)); - - e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status); - if (e_status == eFrameworkunifiedStatusInvldBufSize) - FrameworkunifiedClearMsgData(h_app); - return e_status; - } - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "notify_name=%s ulEvtId=%x ucRid=%x ucCmdid=%x", - rcv_msg.notifyName, rcv_msg.ulEvtId, rcv_msg.ucRid, rcv_msg.ucCmdid); - - switch (rcv_msg.ucCmdid) { - case CAN_CMDID_VERSION_REQ_TX: - e_status = CANCommandVersionReq(h_app, rcv_msg.notifyName); - break; - case CAN_CMDID_FUELCALC_RST_REQ_DELIVERY: - e_status = CANCommandFuelcalcRstReq(h_app, rcv_msg.notifyName); - break; - default: - e_status = CANCommandOther(h_app, - rcv_msg.notifyName, rcv_msg.ucCmdid, rcv_msg.ucRid); - break; - } - return e_status; -} - -static CAN_TRANS_START_TABLE_VAL *CANTxMsgFindMap(CAN_TRANS_START_MSG_DAT *msg) { - std::map<CANID, CAN_TRANS_START_TABLE_VAL *>::iterator it; - it = g_map_trans_data.find(msg->id); - if (it == g_map_trans_data.end()) - return NULL; - return it->second; -} - -static CAN_TRANS_START_TABLE_VAL *CanSendFind(CAN_TRANS_START_MSG_DAT *msg) { - return CANTxMsgFindMap(msg); -} - -EFrameworkunifiedStatus CANTxMsgBit(HANDLE h_app) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanSend(bit)"); - - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - CAN_TRANS_START_MSG_DAT rcv_msg; - CanMessage snd_msg; - CAN_TRANS_START_TABLE_VAL *store; - int32_t i = 0; - uint8_t *store_p; - uint8_t *data_p; - uint8_t *mask_p; - - memset(&rcv_msg, 0, sizeof(rcv_msg)); - memset(&snd_msg, 0, sizeof(snd_msg)); - - e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status); - if (e_status == eFrameworkunifiedStatusInvldBufSize) - FrameworkunifiedClearMsgData(h_app); - goto cleanup; - } - - e_status = eFrameworkunifiedStatusFail; - - if (TRUE != CommGetAvailabilityCurrent(CAN_AVAILABILITY)) { - CANTxMsgErrorLog("CAN is not ready", __func__, 0, 0, h_app); - goto cleanup; - } - - store = CanSendFind(&rcv_msg); - if (!store) { - CANTxMsgErrorLog("No initial value", __func__, - rcv_msg.id, sizeof(rcv_msg.dat), h_app); - goto cleanup; - } - - store_p = store->dat.dat; - data_p = rcv_msg.dat.dat; - mask_p = rcv_msg.mask.dat; - for (i = 0; i < store->dlc; i++) { - *store_p &= (uint8_t)(~(*mask_p)); - *store_p |= ((*mask_p) & (*data_p)); - ++store_p; - ++data_p; - ++mask_p; - } - - snd_msg.can_id = rcv_msg.id; - snd_msg.dlc = store->dlc; - snd_msg.rid = CAN_RID_NOTUSE_CODE; - memcpy(snd_msg.data, store->dat.dat, snd_msg.dlc); - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, - "@@@ Call CanSend for can_hal : " - "can_id=%x dlc=%d rid=%x", snd_msg.can_id, snd_msg.dlc, snd_msg.rid); - FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s", - MessageDataOutputLog(snd_msg.data, snd_msg.dlc).c_str()); - - if (CANHAL_RET_NORMAL != CanSend(h_app, &snd_msg, CAN_HAL_TYPE_CAN)) { - CANTxMsgErrorLog("CAN CanSend failed", __func__, snd_msg.can_id, - (uint16_t)snd_msg.dlc, h_app); - goto cleanup; - } - - // echoback - e_status = CANDeliverySndMsg(h_app, snd_msg.can_id, 0, (uint8_t)snd_msg.dlc, - (const uint8_t *)snd_msg.data, - CID_CAN_DATA_DELIVERY, CANIF_ECHOBACK); -cleanup: - return e_status; -} - -EFrameworkunifiedStatus CANTxMsg(HANDLE h_app) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __func__, "@@@ Start communication CanSend"); - - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - CAN_TRANSMISSION_START_MSG_DAT rcv_msg; - CanMessage snd_msg; - memset(&rcv_msg, 0, sizeof(rcv_msg)); - memset(&snd_msg, 0, sizeof(snd_msg)); - - e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &rcv_msg, sizeof(rcv_msg), eSMRRelease); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetMsgDataOfSize Error(%d)", e_status); - if (e_status == eFrameworkunifiedStatusInvldBufSize) - FrameworkunifiedClearMsgData(h_app); - goto cleanup; - } - - e_status = eFrameworkunifiedStatusFail; - - if (TRUE != CommGetAvailabilityCurrent(CAN_AVAILABILITY)) { - CANTxMsgErrorLog("CAN is not ready", __func__, 0, 0, h_app); - goto cleanup; - } - - snd_msg.can_id = rcv_msg.stCandata.can_id; - snd_msg.dlc = rcv_msg.stCandata.dlc; - snd_msg.rid = rcv_msg.ucRid; - memcpy(snd_msg.data, rcv_msg.stCandata.data, snd_msg.dlc); - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "@@@ Call CanSend for can_hal : " - "can_id=%x dlc=%d rid=%x", snd_msg.can_id, snd_msg.dlc, snd_msg.rid); - FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s", - MessageDataOutputLog(snd_msg.data, snd_msg.dlc).c_str()); - - if (CANHAL_RET_NORMAL != CanSend(h_app, &snd_msg, CAN_HAL_TYPE_CAN)) { - CANTxMsgErrorLog("CAN CanSend failed", __func__, snd_msg.can_id, - (uint16_t)snd_msg.dlc, h_app); - goto cleanup; - } - - // echoback - e_status = CANDeliverySndMsg(h_app, snd_msg.can_id, 0, (uint8_t)snd_msg.dlc, - (const uint8_t *)snd_msg.data, - CID_CAN_DATA_DELIVERY, CANIF_ECHOBACK); - if (rcv_msg.ucRid == (uint8_t)CAN_RID_NOTUSE_CODE) - goto cleanup; - - if (0 < g_m_send_sts.count(snd_msg.can_id)) { - if (g_m_send_sts[snd_msg.can_id].notify_name[0] != 0x00) { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, - "Not yet deliver SendSts but updated(SendID=%x, CAN ID=%x, Nane=%s)", - g_m_send_sts[snd_msg.can_id].rid, snd_msg.can_id, - g_m_send_sts[snd_msg.can_id].notify_name); - } - } - - g_m_send_sts[snd_msg.can_id].rid = rcv_msg.ucRid; - memcpy(g_m_send_sts[snd_msg.can_id].notify_name, - rcv_msg.notifyName, - sizeof(g_m_send_sts[snd_msg.can_id].notify_name)); -cleanup: - return e_status; -} - -EFrameworkunifiedStatus CANSndStsProcess(HANDLE h_app, CanSendResult *rcv_msg, - PS_CommunicationProtocol cid) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - CAN_MSG_SENDSTS snd_msg; - CANID can_id = rcv_msg->can_id; - HANDLE sender = NULL; - memset(&snd_msg, 0, sizeof(snd_msg)); - - if (0 == g_m_send_sts.count(can_id)) - goto cleanup; - - if (0x00 == (g_m_send_sts[can_id].notify_name[0])) - goto cleanup; - - if (rcv_msg->rid != g_m_send_sts[can_id].rid) - goto cleanup; - - snd_msg.hdr.hdr.cid = (uint16_t)cid; - snd_msg.hdr.hdr.msgbodysize = (uint16_t)(sizeof(snd_msg.data)); - snd_msg.hdr.hdr.rid = rcv_msg->rid; - snd_msg.data.ulCanid = can_id; - snd_msg.data.ucStatus = - (CAN_SEND_RESULT_SUCCESS == rcv_msg->result) ? CAN_SUCCESS : CAN_RETRYOUT; - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "cid=%x msgbodysize=%d rid=%x can_id=%x ucStatus=%x", - snd_msg.hdr.hdr.cid, snd_msg.hdr.hdr.msgbodysize, snd_msg.hdr.hdr.rid, - snd_msg.data.ulCanid, snd_msg.data.ucStatus); - - sender = CommonFindSender(h_app, g_m_send_sts[can_id].notify_name); - if (!sender) { - CANTxMsgErrorLog("Could not open sender.", __func__, can_id, - sizeof(snd_msg), h_app); - goto cleanup; - } - - e_status = FrameworkunifiedSendMsg(sender, cid, sizeof(snd_msg), &snd_msg); - if (eFrameworkunifiedStatusOK != e_status) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedSendMsg Error(e_status:%d to:%s)", - e_status, g_m_send_sts[can_id].notify_name); - g_m_send_sts[can_id].notify_name[0] = 0x00; - g_m_send_sts[can_id].rid = 0x00; - goto cleanup; - } - g_m_send_sts[can_id].notify_name[0] = 0x00; - g_m_send_sts[can_id].rid = 0x00; - - e_status = eFrameworkunifiedStatusOK; -cleanup: - return e_status; -} diff --git a/video_in_hal/peripheralservice/communication/server/src/main/communication_application.cpp b/video_in_hal/peripheralservice/communication/server/src/main/communication_application.cpp deleted file mode 100755 index 7240cdb..0000000 --- a/video_in_hal/peripheralservice/communication/server/src/main/communication_application.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -/* - * This file has been generated automatically. - * User hand written code entry is allowed only inside protected zones. - */ - -/* - * This file has been generated automatically. - * User hand written code entry is allowed only inside protected zones. - */ - -#include <native_service/frameworkunified_application.h> -#include <native_service/frameworkunified_framework_if.h> -#include <native_service/frameworkunified_service_protocol.h> -#include <native_service/frameworkunified_multithreading.h> -#include <peripheral_service/communication_notifications.h> -#include <peripheral_service/Canif_API.h> -#include <stdio.h> -#include <signal.h> -#include <string> -#include <sstream> -#include <iostream> -#include "communication_cid.h" -#include "communication_communicationlog.h" -#include "Thread_Common.h" - -extern EFrameworkunifiedStatus CANThreadStart(HANDLE h_app); -extern EFrameworkunifiedStatus CANThreadStop(HANDLE h_app); - -HANDLE g_can_thread = NULL; - -EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - - CommonInit(); - - // API to Register Notification for Service Availability. - e_status = FrameworkunifiedRegisterServiceAvailabilityNotification(h_app, - NTFY_Communication_Availability); - if (eFrameworkunifiedStatusOK != e_status) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "Failed to Register Service Availability Notification."); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, - "Service Availability Notification registered successfully."); - } - - // API to Publish Service Availability Notification. - e_status = FrameworkunifiedPublishServiceAvailability(h_app, FALSE); - if (eFrameworkunifiedStatusOK != e_status) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "Failed to Publish Service Availability Notification."); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, - "Service Availability Notification published successfully."); - } - - g_can_thread = FrameworkunifiedCreateChildThread(h_app, LAN_SERVICE_CAN, - CANThreadStart, CANThreadStop); - if (g_can_thread == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to create CAN"); - } - - // API to Publish Service Availability Notification. - e_status = FrameworkunifiedPublishServiceAvailability(h_app, TRUE); - if (eFrameworkunifiedStatusOK != e_status) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "Failed to Publish Service Availability Notification."); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, - "Service Availability Notification published successfully."); - } - - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnWakeup(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - return e_status; -} - -static EFrameworkunifiedStatus CommThreadCheckAndStart(HANDLE p, HANDLE c, - UI_32 len, PCVOID data, BOOL current) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - if (TRUE != current) { - e_status = FrameworkunifiedStartChildThread(p, c, len, data); - } - return e_status; -} - -static EFrameworkunifiedStatus CommThreadCheckAndStop(HANDLE p, HANDLE c, - UI_32 len, PCVOID data, BOOL current) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - if (TRUE == current) { - e_status = FrameworkunifiedStopChildThread(p, c, len, data); - } - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]"); - - e_status = CommThreadCheckAndStart(h_app, g_can_thread, - 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY)); - if (eFrameworkunifiedStatusOK != e_status) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "Fail to Start CAN Thread. Status:%#x", e_status); - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]"); - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - - e_status = CommThreadCheckAndStop(h_app, g_can_thread, - 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY)); - if (eFrameworkunifiedStatusOK != e_status) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "Fail to Stop CAN Thread. Status:%#x", e_status); - } else { - g_can_thread = NULL; - } - - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]"); - - e_status = CommThreadCheckAndStart(h_app, g_can_thread, - 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY)); - if (eFrameworkunifiedStatusOK != e_status) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "Fail to Start CAN Thread. Status:%#x", e_status); - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]"); - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]"); - - e_status = CommThreadCheckAndStart(h_app, g_can_thread, - 0, NULL, CommGetAvailabilityCurrent(CAN_AVAILABILITY)); - if (eFrameworkunifiedStatusOK != e_status) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "Fail to Start CAN Thread. Status:%#x", e_status); - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]"); - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]"); - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]"); - return e_status; -} - -EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[START]"); - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "[END]"); - return e_status; -} - -std::string MessageDataOutputLog(uint8_t *msg_data, uint32_t len){ - std::string data_log; - int data_buf; - for(uint32_t i = 0; i < len; i++){ - std::ostringstream ss; - data_buf = (int)msg_data[i]; - ss << std::hex << data_buf; - data_log = ss.str() + " " + data_log; - } - return data_log; -} diff --git a/video_in_hal/peripheralservice/communication/server/src/main/communication_main.cpp b/video_in_hal/peripheralservice/communication/server/src/main/communication_main.cpp deleted file mode 100755 index 39daae1..0000000 --- a/video_in_hal/peripheralservice/communication/server/src/main/communication_main.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#include <errno.h> -#include <sys/timerfd.h> -#include <unistd.h> -#include <poll.h> - -#include <native_service/frameworkunified_dispatcher.h> -#include <native_service/frameworkunified_application.h> -#include <native_service/frameworkunified_multithreading.h> - -#include <native_service/ns_version_if.h> -#include <system_service/ss_system_if.h> -#include <system_service/ss_sm_client_if.h> -#include "communication_communicationlog.h" -#include "communication_version.h" -#include "communication_cid.h" - -#include "CAN_Thread.h" -#include "Thread_Common.h" - -CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION); - -FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { - FRAMEWORKUNIFIEDLOGOPTIONS, - {ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12, - ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15, - ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18, - ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21, - ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24, - ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27, - ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30, - ZONE_TEXT_31}, - FRAMEWORKUNIFIEDLOGZONES}; - -extern HANDLE g_can_thread; -static bool capture_log_flg = FALSE; - -#define COMMSYS_SND_ERR_CNT_MAX 10 - -static void MessageHandler(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - e_status = FrameworkunifiedDispatchProcessWithoutLoop(h_app); - if (e_status != eFrameworkunifiedStatusOK) { - // Ignore Error. Logging only. - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedDispatchProcessWithoutLoop: %d", e_status); - } -} - -static void TimeoutHandlerCAN(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - uint32_t dummy = 0; - static uint32_t snd_err_cnt_can = 0; - - if (CommGetAvailabilityCurrent(CAN_AVAILABILITY)) { - e_status = FrameworkunifiedSendChild(h_app, g_can_thread, - CID_COMMSYS_TIMEOUT, 0, &dummy); - if (e_status != eFrameworkunifiedStatusOK) { - snd_err_cnt_can++; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, - "FrameworkunifiedSendChild(timeout for can) faild: %d", e_status); - - if (capture_log_flg) - return; - - if (snd_err_cnt_can < COMMSYS_SND_ERR_CNT_MAX) - return; - - SendUserInvokedLoggingRequestToSystemManager( - e_SS_SM_CAPTURE_DTC_LOGS, "Send CAN TimeoutNtfy Error"); - capture_log_flg = true; - } else { - snd_err_cnt_can = 0; - } - } -} - -int main(int argc, char *argv[]) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - FrameworkunifiedDefaultCallbackHandler cb_funcs; - FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(cb_funcs); - HANDLE h_app; - FRAMEWORKUNIFIED_SET_ZONES(); - struct pollfd fds[2]; - int ret; - - e_status = FrameworkunifiedCreateDispatcherWithoutLoop(LAN_SERVICE_MAIN, - h_app, argc, argv, &cb_funcs, TRUE); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedCreateDispatcherWithoutLoop: %d", e_status); - return EXIT_FAILURE; - } - - e_status = FrameworkunifiedGetDispatcherFD(h_app, &fds[0].fd); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedGetDispatcherFD: %d", e_status); - return EXIT_FAILURE; - } - - if ((fds[1].fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC)) == -1) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_create: %d", errno); - return EXIT_FAILURE; - } - - struct itimerspec tm; - tm.it_value.tv_sec = 0; - tm.it_value.tv_nsec = 100 * 1000 * 1000; - tm.it_interval.tv_sec = 0; - tm.it_interval.tv_nsec = 100 * 1000 * 1000; - if (timerfd_settime(fds[1].fd, 0, &tm, NULL) == -1) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "timerfd_settime: %d", errno); - return EXIT_FAILURE; - } - fds[0].events = POLLIN; - fds[1].events = POLLIN; - - while (1) { - ret = poll(fds, sizeof(fds) / sizeof(struct pollfd), -1); - if (ret < 0) { - if (errno == EINTR) { - continue; - } - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "poll errno:%d", errno); - continue; - } - - if ((fds[0].revents & POLLIN) != 0) { - MessageHandler(h_app); - continue; - } - - if ((fds[1].revents & POLLIN) != 0) { - uint64_t exp; - read(fds[1].fd, &exp, sizeof(uint64_t)); - TimeoutHandlerCAN(h_app); - continue; - } - } - return EXIT_SUCCESS; -}
\ No newline at end of file diff --git a/video_in_hal/peripheralservice/communication/server/src/threads/CAN_Thread.cpp b/video_in_hal/peripheralservice/communication/server/src/threads/CAN_Thread.cpp deleted file mode 100755 index 1b327e7..0000000 --- a/video_in_hal/peripheralservice/communication/server/src/threads/CAN_Thread.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* - * @copyright Copyright (c) 2016-2020 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. - */ - -#include "CAN_Thread.h" - -extern "C" { -#include <poll.h> -#include <sys/timerfd.h> -} -#include <native_service/frameworkunified_types.h> -#include <native_service/frameworkunified_framework_if.h> -#include <native_service/frameworkunified_timer.h> -#include <peripheral_service/Canif_API.h> -#include <peripheral_service/communication_notifications.h> -#include <can_hal.h> -#include <stdlib.h> -#include <errno.h> -#include <string.h> -#include <agl_thread.h> -#include <string> -#include "CAN_Delivery.h" -#include "CAN_CommWatch.h" -#include "CAN_TxMsg.h" - -#include "communication_communicationlog.h" -#include "communication_cid.h" -#include "Thread_Common.h" - -static EFrameworkunifiedStatus CANStateCallback(HANDLE h_app); -static EFrameworkunifiedStatus CANHalRcvProcess(HANDLE h_app); -static EFrameworkunifiedStatus CANHalSndStsProcess(HANDLE h_app); - -static const FrameworkunifiedProtocolCallbackHandler kCanPcbhs[] = { - {CID_CANIF_DELIVERY_ENTRY, CANDeliveryEntry}, - {CID_CANIF_DELIVERY_ERASE, CANClearEntry}, - {CID_COMMSYS_TIMEOUT, CANCallbackForTimeOut}, - {CID_CANIF_TX_START, CANTxMsg}, - {CID_CANIF_TX_BIT_START, CANTxMsgBit}, - {CID_CANIF_COMM_WATCH, CANCommWatch}, - {CID_CANIF_CMD_CTRL, CANTxMsgCommand}, - {CID_CANHAL_CMD_CAN_READY, CANStateCallback}, - {CID_CANHAL_CMD_ERROR_NOTIFY, CommonCanHalErrorNotify}, - {CID_CANHAL_CMD_CAN_RECV, CANHalRcvProcess}, - {CID_CANHAL_CMD_CAN_SEND_STATUS, CANHalSndStsProcess}, -}; - -static UI_32 kCanPcbhsD[] = { - CID_CANIF_DELIVERY_ENTRY, - CID_CANIF_DELIVERY_ERASE, - CID_COMMSYS_TIMEOUT, - CID_CANIF_TX_START, - CID_CANIF_TX_BIT_START, - CID_CANIF_COMM_WATCH, - CID_CANIF_CMD_CTRL, - CID_CANHAL_CMD_CAN_READY, - CID_CANHAL_CMD_ERROR_NOTIFY, - CID_CANHAL_CMD_CAN_RECV, - CID_CANHAL_CMD_CAN_SEND_STATUS -}; - -static EFrameworkunifiedStatus CANStateCallback(HANDLE h_app) { - bool result; - EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK; - - err = FrameworkunifiedGetMsgDataOfSize(h_app, &result, sizeof(result), eSMRRelease); - if (err != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize failed"); - } - if (err == eFrameworkunifiedStatusInvldBufSize) { - FrameworkunifiedClearMsgData(h_app); - return eFrameworkunifiedStatusFail; - } else if (err != eFrameworkunifiedStatusOK) { - return eFrameworkunifiedStatusFail; - } - - CommSetAvailabilityCurrent(CAN_AVAILABILITY); - return CommonStartNotify(h_app, NTFY_Communication_CAN_ISAVAILABLE); -} - -static EFrameworkunifiedStatus CANThreadCanOpen(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - const char *result = "Unknown"; - const char *called = "Unknown"; - UI_16 z = ZONE_ERR; - - e_status = ConvRet(CanOpen(h_app, CAN_HAL_TYPE_CAN)); - result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success"; - z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR; - called = "CanOpen"; - FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s", called, result); - return e_status; -} - -EFrameworkunifiedStatus CANThreadStart(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - - CommClrAvailabilityCurrent(CAN_AVAILABILITY); - CANDeliveryInit(); - CANCommWatchInit(); - CANTxMsgInit(); - - e_status = CommonThreadStart(h_app, kCanPcbhs, _countof(kCanPcbhs), - NTFY_Communication_CAN_ISAVAILABLE, CANThreadCanOpen); - return e_status; -} - -static EFrameworkunifiedStatus CANThreadCanClose(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - const char *result = "Unknown"; - const char *called = "Unknown"; - UI_16 z = ZONE_ERR; - - e_status = ConvRet(CanClose(h_app, CAN_HAL_TYPE_CAN)); - result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success"; - z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR; - called = "CanClose"; - FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s", called, result); - return e_status; -} - -EFrameworkunifiedStatus CANThreadStop(HANDLE h_app) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - - CommClrAvailabilityCurrent(CAN_AVAILABILITY); - e_status = CommonThreadStop(h_app, kCanPcbhsD, _countof(kCanPcbhsD), - NTFY_Communication_CAN_ISAVAILABLE, - CANThreadCanClose); - return e_status; -} - -static EFrameworkunifiedStatus CANHalRcvProcess(HANDLE h_app) { - CanMessage canhal_recv_data; - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusFail; - uint8_t cmd = 0; - - e_status = FrameworkunifiedGetMsgDataOfSize(h_app, &canhal_recv_data, - sizeof(canhal_recv_data), eSMRRelease); - if (e_status != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : FrameworkunifiedGetMsgDataOfSize is failed, e_status=%d", e_status); - } - - if (e_status == eFrameworkunifiedStatusInvldBufSize) { - FrameworkunifiedClearMsgData(h_app); - goto cleanup; - } else if (e_status != eFrameworkunifiedStatusOK) { - goto cleanup; - } - - if (canhal_recv_data.dlc > CAN_MESSAGE_LEN) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : Invalid data length, dlc=%d", canhal_recv_data.dlc); - return eFrameworkunifiedStatusFail; - } - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __func__, "can_id=%x dlc=%d rid=%x", - canhal_recv_data.can_id, canhal_recv_data.dlc, canhal_recv_data.rid); - FRAMEWORKUNIFIEDLOG(ZONE_DEBUG, __func__, "msg_data=%s", - MessageDataOutputLog(canhal_recv_data.data, canhal_recv_data.dlc).c_str()); - - cmd = (uint8_t)(canhal_recv_data.can_id & 0xFF); - switch (canhal_recv_data.can_id) { - case CAN_CMDID_STARTUP_FIN_RESP_RX: - e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd); - break; - case CAN_CMDID_MRST_INFO_RESP_RX: - e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd); - break; - case CAN_CMDID_VERSION_RESP_RX: - e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd); - break; - case CAN_CMDID_CONNECTION_NODE_RESP_RX: - e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd); - break; - case CAN_CMDID_FUELCALC_RST_REQ_RX: - CANCommandSetFuelCalcRstReq(); - e_status = CANCommandDeliveryRcvProcess(h_app, &canhal_recv_data, cmd); - break; - default: - e_status = CANDeliveryRcvProcess(h_app, &canhal_recv_data); - } -cleanup: - return e_status; -} - -static EFrameworkunifiedStatus CANHalSndStsProcess(HANDLE h_app) { - CanSendResult canhal_recv_data; - EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK; - uint8_t ui_can_rid; - PS_CommunicationProtocol cid; - - err = FrameworkunifiedGetMsgDataOfSize(h_app, &canhal_recv_data, - sizeof(canhal_recv_data), eSMRRelease); - if (err != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error : FrameworkunifiedGetMsgDataOfSize is failed, err=%d", err); - } - - if (err == eFrameworkunifiedStatusInvldBufSize) { - FrameworkunifiedClearMsgData(h_app); - return eFrameworkunifiedStatusFail; - } else if (err != eFrameworkunifiedStatusOK) { - return eFrameworkunifiedStatusFail; - } - - ui_can_rid = canhal_recv_data.rid; - if (CAN_RID_NOTUSE_CODE == ui_can_rid) { - return eFrameworkunifiedStatusOK; - } - - switch (canhal_recv_data.can_id) { - case CAN_CMDID_MRST_INFO_REQ_TX: - case CAN_CMDID_CONNECTION_NODE_REQ_TX: - case CAN_CMDID_FUELCALC_REQ_TX: - cid = CID_CAN_CMD_TX_RESULT; - break; - default: - cid = CID_CAN_TX_RESULT; - break; - } - - return CANSndStsProcess(h_app, &canhal_recv_data, cid); -} - -EFrameworkunifiedStatus CANCallbackForTimeOut(HANDLE h_app) { - CANCommWatchTimeout(h_app); - return eFrameworkunifiedStatusOK; -} diff --git a/video_in_hal/peripheralservice/communication/server/src/threads/Thread_Common.cpp b/video_in_hal/peripheralservice/communication/server/src/threads/Thread_Common.cpp deleted file mode 100755 index 718d948..0000000 --- a/video_in_hal/peripheralservice/communication/server/src/threads/Thread_Common.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2019-2020 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. - */ - -#include <stdint.h> -#include <boost/atomic.hpp> -#include <pthread.h> - -#include <native_service/frameworkunified_types.h> -#include <native_service/frameworkunified_framework_if.h> -#include <native_service/frameworkunified_timer.h> -#include <agl_thread.h> -#include <can_hal.h> -#include "communication_communicationlog.h" -#include "communication_cid.h" -#include "Thread_Common.h" - -static std::map<std::string, HANDLE> g_map_sender; -static pthread_mutex_t g_sender_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; -static boost::atomic<int32_t> availabilityCurrent; - -void CommonInit(void) { - pthread_mutex_lock(&g_sender_mutex); - g_map_sender.clear(); - pthread_mutex_unlock(&g_sender_mutex); -} - -HANDLE CommonFindSender(HANDLE h_app, std::string s) { - HANDLE ret = NULL; - std::string app(FrameworkunifiedGetAppName(h_app)); - std::string key = s + app; - std::map<std::string, HANDLE>::iterator it = g_map_sender.find(key); - - pthread_mutex_lock(&g_sender_mutex); - - if (it != g_map_sender.end()) { - ret = g_map_sender[key]; - goto cleanup; - } - - ret = FrameworkunifiedMcOpenSender(h_app, s.c_str()); - if (ret) { - g_map_sender[key] = ret; - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "FrameworkunifiedMcOpenSender Error(to:%s)", s.c_str()); - } - -cleanup: - pthread_mutex_unlock(&g_sender_mutex); - return ret; -} - -void CommSetAvailabilityCurrent(int32_t current) { - availabilityCurrent |= current; -} - -void CommClrAvailabilityCurrent(int32_t current) { - availabilityCurrent &= (~current); -} - -BOOL CommGetAvailabilityCurrent(int32_t current) { - return !(!(availabilityCurrent & current)); -} - -EFrameworkunifiedStatus CommonStartNotify(HANDLE h_app, PCSTR cmd) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - const char *result = "Unknown"; - const char *called = "Unknown"; - const BOOL avail = TRUE; - UI_16 z = ZONE_ERR; - - e_status = FrameworkunifiedNPPublishNotification(h_app, cmd, &avail , sizeof(avail)); - result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success"; - z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR; - called = "FrameworkunifiedNPPublishNotification"; - FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status); - return e_status; -} - -EFrameworkunifiedStatus CommonCanHalErrorNotify(HANDLE h_app) { - char msg[CANHAL_ERROR_MESSAGE_LEN] = {0}; - EFrameworkunifiedStatus err = eFrameworkunifiedStatusOK; - - err = FrameworkunifiedGetMsgDataOfSize(h_app, &msg, sizeof(msg), eSMRRelease); - if (err != eFrameworkunifiedStatusOK) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize is failed, err=%d", err); - } - - if (err == eFrameworkunifiedStatusInvldBufSize) { - FrameworkunifiedClearMsgData(h_app); - return eFrameworkunifiedStatusFail; - } else if (err != eFrameworkunifiedStatusOK) { - return eFrameworkunifiedStatusFail; - } - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __func__, "can_hal error : %s", msg); - return err; -} - -EFrameworkunifiedStatus CommonThreadStart(HANDLE h_app, const FrameworkunifiedProtocolCallbackHandler *cb, - UI_32 count, PCSTR cmd, EFrameworkunifiedStatus (*open_func)(HANDLE)) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - const char *result = "Unknown"; - const char *called = "Unknown"; - UI_16 z = ZONE_ERR; - - e_status = FrameworkunifiedAttachCallbacksToDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, cb, count); - result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success"; - z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR; - called = "FrameworkunifiedAttachCallbacksFromDispatcher"; - FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s(%d)", called, result, e_status); - if (e_status != eFrameworkunifiedStatusOK) - return e_status; - - e_status = open_func(h_app); - if (e_status != eFrameworkunifiedStatusOK) - return e_status; - - e_status = FrameworkunifiedNPRegisterNotification(h_app, cmd, - sizeof(EFrameworkunifiedStatus), eFrameworkunifiedStateVar); - result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success"; - z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR; - called = "FrameworkunifiedNPRegisterNotification"; - FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status); - if (e_status != eFrameworkunifiedStatusOK) - return e_status; - - return e_status; -} - -EFrameworkunifiedStatus CommonThreadStop(HANDLE h_app, const PUI_32 cb, - UI_32 count, PCSTR cmd, EFrameworkunifiedStatus (*close_func)(HANDLE)) { - EFrameworkunifiedStatus e_status = eFrameworkunifiedStatusOK; - const BOOL avail = FALSE; - const char *result = "Unknown"; - const char *called = "Unknown"; - UI_16 z = ZONE_ERR; - - e_status = FrameworkunifiedNPPublishNotification(h_app, cmd, &avail , sizeof(avail)); - result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success"; - z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR; - called = "FrameworkunifiedNPPublishNotification"; - FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status); - if (e_status != eFrameworkunifiedStatusOK) - return e_status; - - e_status = FrameworkunifiedNPUnRegisterNotification(h_app, cmd); - result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success"; - z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR; - called = "FrameworkunifiedNPUnRegisterNotification"; - FRAMEWORKUNIFIEDLOG(z, __func__, "%s(%s) %s(%d)", called, cmd, result, e_status); - if (e_status != eFrameworkunifiedStatusOK) - return e_status; - - e_status = FrameworkunifiedDetachCallbacksFromDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, cb, count); - result = (e_status != eFrameworkunifiedStatusOK) ? "failed" : "success"; - z = (e_status != eFrameworkunifiedStatusOK) ? ZONE_INFO : ZONE_ERR; - called = "FrameworkunifiedDetachCallbacksFromDispatcher"; - FRAMEWORKUNIFIEDLOG(z, __func__, "%s %s(%d)", called, result, e_status); - if (e_status != eFrameworkunifiedStatusOK) - return e_status; - - e_status = close_func(h_app); - if (e_status != eFrameworkunifiedStatusOK){ - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: close_func() failed"); - return e_status; - } - - return e_status; -} - diff --git a/video_in_hal/peripheralservice/peripheral_service.mk b/video_in_hal/peripheralservice/peripheral_service.mk deleted file mode 100755 index c054722..0000000 --- a/video_in_hal/peripheralservice/peripheral_service.mk +++ /dev/null @@ -1,44 +0,0 @@ -############################################################# -# -# Common Makefile for peripheral_service -# Copyright (C) 2017-2020 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. -# -############################################################# - -CURRENT_DIR := $(dir $(lastword $(MAKEFILE_LIST))) - -############################################################# -# COMPONENT_NAME must not be blank and be named snake_case - -COMPONENT_NAME := peripheral_service - -############################################################# - - - -############################################################# -# You can add several flags and libraries. -# When you add -I or -L path, DO NOT USE relative path. -# Instead, use $(CURRENT_DIR) variable -# that indicates the path this .mk file is stored. - -COMPONENT_CFLAGS := -COMPONENT_CXXFLAGS := -COMPONENT_LDLIBS := -COMPONENT_LDFLAGS := - -############################################################## - -include $(SDKTARGETSYSROOT)/usr/agl/share/agl.mk |