From 2eca81afe6cccdb9b5dc732aafa551a7dbe4ae0a Mon Sep 17 00:00:00 2001 From: fancy <258828110.@qq.com> Date: Sat, 16 Sep 2023 09:30:13 -0700 Subject: [PATCH] Backup. --- middleware/IpcConfig/include/IIpcConfig.h | 14 ++++++++++++ middleware/IpcConfig/src/IIpcConfig.cpp | 14 ++++++++++++ middleware/IpcConfig/src/IpcConfig.cpp | 22 +++++++++++++++---- middleware/IpcConfig/src/IpcConfig.h | 14 ++++++++++++ middleware/IpcConfig/src/IpcConfigMakePtr.cpp | 14 ++++++++++++ middleware/IpcConfig/src/IpcConfigMakePtr.h | 14 ++++++++++++ utils/Config/include/Config.h | 14 ++++++++++++ utils/Config/src/Config.c | 14 ++++++++++++ utils/Config/src/ConfigCode.c | 14 ++++++++++++ utils/Config/src/ConfigCode.h | 14 ++++++++++++ utils/Config/src/ConfigImpl.c | 17 ++++++++++++-- utils/Config/src/ConfigImpl.h | 14 ++++++++++++ utils/StatusCode/include/StatusCode.h | 14 ++++++++++++ utils/StatusCode/src/StatusCode.c | 14 ++++++++++++ 14 files changed, 201 insertions(+), 6 deletions(-) diff --git a/middleware/IpcConfig/include/IIpcConfig.h b/middleware/IpcConfig/include/IIpcConfig.h index 393fb215..4d88f56a 100644 --- a/middleware/IpcConfig/include/IIpcConfig.h +++ b/middleware/IpcConfig/include/IIpcConfig.h @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 IIPCCONFIG_H #define IIPCCONFIG_H #include "StatusCode.h" diff --git a/middleware/IpcConfig/src/IIpcConfig.cpp b/middleware/IpcConfig/src/IIpcConfig.cpp index 2c548f7c..2e63d28a 100644 --- a/middleware/IpcConfig/src/IIpcConfig.cpp +++ b/middleware/IpcConfig/src/IIpcConfig.cpp @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 "IIpcConfig.h" #include "ILog.h" std::shared_ptr &IIpcConfig::GetInstance(std::shared_ptr *impl) diff --git a/middleware/IpcConfig/src/IpcConfig.cpp b/middleware/IpcConfig/src/IpcConfig.cpp index 17052639..543665d9 100644 --- a/middleware/IpcConfig/src/IpcConfig.cpp +++ b/middleware/IpcConfig/src/IpcConfig.cpp @@ -1,7 +1,20 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 "IpcConfig.h" #include "ILog.h" #include -// #include IpcConfig::IpcConfig() { mCfgChanged = CONFIG_HAS_NOT_CHANGED; @@ -53,6 +66,7 @@ void IpcConfig::SetInt(const IpcConfigKey &key, const int &value) if (iter != mCfgMapInt.end()) { iter->second.get() = value; + mCfgChanged = CONFIG_HAS_CHANGED; } else { @@ -61,19 +75,19 @@ void IpcConfig::SetInt(const IpcConfigKey &key, const int &value) } void IpcConfig::ReadAllConfigParameters(void) { - bool configChanging = false; StatusCode code = ConfigGetInt(mCfg, "test_num", &(mAllData.testNum)); if (StatusCodeEqual(code, "CONFIG_CODE_PARAM_NOT_EXIST")) { LogWarning("test_num doesn't exist, will make it as default.\n"); - configChanging = true; + mCfgChanged = CONFIG_HAS_CHANGED; constexpr int DEFAULT_TEST_NUM = 10; mAllData.testNum = DEFAULT_TEST_NUM; ConfigSetInt(mCfg, "test_num", mAllData.testNum); } - if (true == configChanging) + if (CONFIG_HAS_CHANGED == mCfgChanged) { LogInfo("Save the config file.\n"); + mCfgChanged = CONFIG_HAS_NOT_CHANGED; ConfigSaveFile(mCfg); } } \ No newline at end of file diff --git a/middleware/IpcConfig/src/IpcConfig.h b/middleware/IpcConfig/src/IpcConfig.h index a6a328c9..6c6c373f 100644 --- a/middleware/IpcConfig/src/IpcConfig.h +++ b/middleware/IpcConfig/src/IpcConfig.h @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 IPCCONFIG_H #define IPCCONFIG_H #include "StatusCode.h" diff --git a/middleware/IpcConfig/src/IpcConfigMakePtr.cpp b/middleware/IpcConfig/src/IpcConfigMakePtr.cpp index c9141ab8..d1e5d7a8 100644 --- a/middleware/IpcConfig/src/IpcConfigMakePtr.cpp +++ b/middleware/IpcConfig/src/IpcConfigMakePtr.cpp @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 "IpcConfigMakePtr.h" #include "ILog.h" #include "IpcConfig.h" diff --git a/middleware/IpcConfig/src/IpcConfigMakePtr.h b/middleware/IpcConfig/src/IpcConfigMakePtr.h index 49311c41..28b750f7 100644 --- a/middleware/IpcConfig/src/IpcConfigMakePtr.h +++ b/middleware/IpcConfig/src/IpcConfigMakePtr.h @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef IPC_CONFIG_MAKE_PTR_H #define IPC_CONFIG_MAKE_PTR_H #include "IIpcConfig.h" diff --git a/utils/Config/include/Config.h b/utils/Config/include/Config.h index e2955355..aa0984fe 100644 --- a/utils/Config/include/Config.h +++ b/utils/Config/include/Config.h @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 CONFIG_H #define CONFIG_H #include "StatusCode.h" diff --git a/utils/Config/src/Config.c b/utils/Config/src/Config.c index 5bc2ec46..f1dd6d9e 100644 --- a/utils/Config/src/Config.c +++ b/utils/Config/src/Config.c @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 "Config.h" #include "ConfigImpl.h" #include "ILog.h" diff --git a/utils/Config/src/ConfigCode.c b/utils/Config/src/ConfigCode.c index 8dc916bf..faa2b642 100644 --- a/utils/Config/src/ConfigCode.c +++ b/utils/Config/src/ConfigCode.c @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 "ConfigCode.h" #include "ILog.h" #include diff --git a/utils/Config/src/ConfigCode.h b/utils/Config/src/ConfigCode.h index 546733bc..e014d14d 100644 --- a/utils/Config/src/ConfigCode.h +++ b/utils/Config/src/ConfigCode.h @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 CONFIGCODE_H #define CONFIGCODE_H #include "Config.h" diff --git a/utils/Config/src/ConfigImpl.c b/utils/Config/src/ConfigImpl.c index 011a0ecf..3e9d82fd 100644 --- a/utils/Config/src/ConfigImpl.c +++ b/utils/Config/src/ConfigImpl.c @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 "ConfigImpl.h" #include "ILog.h" #include "ConfigCode.h" @@ -42,8 +56,7 @@ static const StatusCode ConfigGetIntImpl(VConfig *cfg, const char *name, int *va } static const StatusCode ConfigSetIntImpl(VConfig *cfg, const char *name, const int value) { - int result = 0; - config_setting_t *root, *setting, *movie; + config_setting_t *root, *setting; root = config_root_setting(&(((Config *)cfg)->cfg)); setting = config_setting_add(root, name, CONFIG_TYPE_INT); config_setting_set_int(setting, value); diff --git a/utils/Config/src/ConfigImpl.h b/utils/Config/src/ConfigImpl.h index fd2deded..d1f50e25 100644 --- a/utils/Config/src/ConfigImpl.h +++ b/utils/Config/src/ConfigImpl.h @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 CONFIGIMPL_H #define CONFIGIMPL_H #include "Config.h" diff --git a/utils/StatusCode/include/StatusCode.h b/utils/StatusCode/include/StatusCode.h index 1b0c5ba0..69f3d9f9 100644 --- a/utils/StatusCode/include/StatusCode.h +++ b/utils/StatusCode/include/StatusCode.h @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 STATUSCODE_H #define STATUSCODE_H #include diff --git a/utils/StatusCode/src/StatusCode.c b/utils/StatusCode/src/StatusCode.c index 1400e417..f07b8060 100644 --- a/utils/StatusCode/src/StatusCode.c +++ b/utils/StatusCode/src/StatusCode.c @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2023 JIUYILIAN Co., Ltd. + * 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 "StatusCode.h" #include "ILog.h" #include