Skip to content

Commit da17185

Browse files
author
Ubuntu
committed
Merge branch 'config-shadow-update' of https://github.com/awslabs/aws-iot-device-client into config-shadow-update
2 parents 52c8729 + 7fcb414 commit da17185

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+255
-208
lines changed

.github/workflows/build.yml

+19-19
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ jobs:
3737
docker pull $DOCKER_IMAGE
3838
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE
3939
- name: Archive ubuntu Build Artifact
40-
uses: actions/upload-artifact@v3
40+
uses: actions/upload-artifact@v4
4141
# Run for main branch only
4242
if: github.ref == 'refs/heads/main'
4343
with:
4444
name: "DC.ubuntu.x64.${{ env.PACKAGE_NAME }}.static"
4545
path: |
4646
./build/${{ env.PACKAGE_NAME }}
4747
- name: Archive setup files
48-
uses: actions/upload-artifact@v3
48+
uses: actions/upload-artifact@v4
4949
# Run for main branch only
5050
if: github.ref == 'refs/heads/main'
5151
with:
@@ -77,15 +77,15 @@ jobs:
7777
docker pull $DOCKER_IMAGE
7878
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE
7979
- name: Archive amazonlinux Build Artifact
80-
uses: actions/upload-artifact@v3
80+
uses: actions/upload-artifact@v4
8181
# Run for main branch only
8282
if: github.ref == 'refs/heads/main'
8383
with:
8484
name: "DC.amazonlinux.x64.${{ env.PACKAGE_NAME }}.static"
8585
path: |
8686
./build/${{ env.PACKAGE_NAME }}
8787
- name: Archive setup files
88-
uses: actions/upload-artifact@v3
88+
uses: actions/upload-artifact@v4
8989
# Run for main branch only
9090
if: github.ref == 'refs/heads/main'
9191
with:
@@ -117,15 +117,15 @@ jobs:
117117
docker pull $DOCKER_IMAGE
118118
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE
119119
- name: Archive rhel-ubi8 Build Artifact
120-
uses: actions/upload-artifact@v3
120+
uses: actions/upload-artifact@v4
121121
# Run for main branch only
122122
if: github.ref == 'refs/heads/main'
123123
with:
124124
name: "DC.rhel.x64.${{ env.PACKAGE_NAME }}.static"
125125
path: |
126126
./build/${{ env.PACKAGE_NAME }}
127127
- name: Archive setup files
128-
uses: actions/upload-artifact@v3
128+
uses: actions/upload-artifact@v4
129129
# Run for main branch only
130130
if: github.ref == 'refs/heads/main'
131131
with:
@@ -211,15 +211,15 @@ jobs:
211211
docker pull $DOCKER_IMAGE
212212
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE --compile-mode=armhf_cross_mode
213213
- name: Archive armhf32 Build Artifact
214-
uses: actions/upload-artifact@v3
214+
uses: actions/upload-artifact@v4
215215
# Run for main branch only
216216
if: github.ref == 'refs/heads/main'
217217
with:
218218
name: "DC.linux.armhf.${{ env.PACKAGE_NAME }}.static"
219219
path: |
220220
./build/${{ env.PACKAGE_NAME }}
221221
- name: Archive setup files
222-
uses: actions/upload-artifact@v3
222+
uses: actions/upload-artifact@v4
223223
# Run for main branch only
224224
if: github.ref == 'refs/heads/main'
225225
with:
@@ -251,15 +251,15 @@ jobs:
251251
docker pull $DOCKER_IMAGE
252252
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE --compile-mode=mips_cross_mode
253253
- name: Archive mips32 Build Artifact
254-
uses: actions/upload-artifact@v3
254+
uses: actions/upload-artifact@v4
255255
# Run for main branch only
256256
if: github.ref == 'refs/heads/main'
257257
with:
258258
name: "DC.linux.mips.${{ env.PACKAGE_NAME }}.static"
259259
path: |
260260
./build/${{ env.PACKAGE_NAME }}
261261
- name: Archive setup files
262-
uses: actions/upload-artifact@v3
262+
uses: actions/upload-artifact@v4
263263
# Run for main branch only
264264
if: github.ref == 'refs/heads/main'
265265
with:
@@ -291,15 +291,15 @@ jobs:
291291
docker pull $DOCKER_IMAGE
292292
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE --compile-mode=aarch64_cross_mode
293293
- name: Archive aarch64 Build Artifact
294-
uses: actions/upload-artifact@v3
294+
uses: actions/upload-artifact@v4
295295
# Run for main branch only
296296
if: github.ref == 'refs/heads/main'
297297
with:
298298
name: "DC.linux.aarch64.${{ env.PACKAGE_NAME }}.static"
299299
path: |
300300
./build/${{ env.PACKAGE_NAME }}
301301
- name: Archive setup files
302-
uses: actions/upload-artifact@v3
302+
uses: actions/upload-artifact@v4
303303
# Run for main branch only
304304
if: github.ref == 'refs/heads/main'
305305
with:
@@ -331,15 +331,15 @@ jobs:
331331
docker pull $DOCKER_IMAGE
332332
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE --compile-mode=ppc64_cross_mode
333333
- name: Archive aarch64 Build Artifact
334-
uses: actions/upload-artifact@v3
334+
uses: actions/upload-artifact@v4
335335
# Run for main branch only
336336
if: github.ref == 'refs/heads/main'
337337
with:
338338
name: "DC.linux.ppc64.${{ env.PACKAGE_NAME }}.static"
339339
path: |
340340
./build/${{ env.PACKAGE_NAME }}
341341
- name: Archive setup files
342-
uses: actions/upload-artifact@v3
342+
uses: actions/upload-artifact@v4
343343
# Run for main branch only
344344
if: github.ref == 'refs/heads/main'
345345
with:
@@ -371,15 +371,15 @@ jobs:
371371
docker pull $DOCKER_IMAGE
372372
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE --compile-mode=ppc64le_cross_mode
373373
- name: Archive aarch64 Build Artifact
374-
uses: actions/upload-artifact@v3
374+
uses: actions/upload-artifact@v4
375375
# Run for main branch only
376376
if: github.ref == 'refs/heads/main'
377377
with:
378378
name: "DC.linux.ppc64le.${{ env.PACKAGE_NAME }}.static"
379379
path: |
380380
./build/${{ env.PACKAGE_NAME }}
381381
- name: Archive setup files
382-
uses: actions/upload-artifact@v3
382+
uses: actions/upload-artifact@v4
383383
# Run for main branch only
384384
if: github.ref == 'refs/heads/main'
385385
with:
@@ -411,7 +411,7 @@ jobs:
411411
docker pull $DOCKER_IMAGE
412412
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE --compile-mode=st_component_mode
413413
- name: Archive ST Ubuntu aarch64 Build Artifact
414-
uses: actions/upload-artifact@v3
414+
uses: actions/upload-artifact@v4
415415
# Run for main branch only
416416
if: github.ref == 'refs/heads/main'
417417
with:
@@ -443,7 +443,7 @@ jobs:
443443
docker pull $DOCKER_IMAGE
444444
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE --compile-mode=st_aarch64_cross_mode
445445
- name: Archive ST Ubuntu aarch64 Build Artifact
446-
uses: actions/upload-artifact@v3
446+
uses: actions/upload-artifact@v4
447447
# Run for main branch only
448448
if: github.ref == 'refs/heads/main'
449449
with:
@@ -475,7 +475,7 @@ jobs:
475475
docker pull $DOCKER_IMAGE
476476
docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} --env GITHUB_REF $DOCKER_IMAGE --compile-mode=st_armhf_cross_mode
477477
- name: Archive st armhf32 Build Artifact
478-
uses: actions/upload-artifact@v3
478+
uses: actions/upload-artifact@v4
479479
# Run for main branch only
480480
if: github.ref == 'refs/heads/main'
481481
with:

source/ClientBaseNotification.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Aws
3838
SUBSCRIPTION_FAILED
3939
};
4040
} // namespace DeviceClient
41-
} // namespace Iot
41+
} // namespace Iot
4242
} // namespace Aws
4343

4444
#endif // DEVICE_CLIENT_CLIENTBASENOTIFICATION_H

source/ClientBaseNotifier.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace Aws
5050
const std::string &message) = 0;
5151
};
5252
} // namespace DeviceClient
53-
} // namespace Iot
53+
} // namespace Iot
5454
} // namespace Aws
5555

5656
#endif // DEVICE_CLIENT_CLIENTBASENOTIFIER_H

source/Feature.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace Aws
5353
virtual std::string getName() = 0;
5454
};
5555
} // namespace DeviceClient
56-
} // namespace Iot
56+
} // namespace Iot
5757
} // namespace Aws
5858

5959
#endif // DEVICE_CLIENT_FEATURE_H

source/FeatureRegistry.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ void FeatureRegistry::disable(const std::string &name)
5050
std::size_t FeatureRegistry::getSize() const
5151
{
5252
std::lock_guard<std::mutex> lock(featuresLock);
53-
return count_if(features.begin(), features.end(), [](const std::pair<string, std::shared_ptr<Feature>> &feature) {
54-
return feature.second != nullptr;
55-
});
53+
return count_if(
54+
features.begin(),
55+
features.end(),
56+
[](const std::pair<string, std::shared_ptr<Feature>> &feature) { return feature.second != nullptr; });
5657
}
5758

5859
void FeatureRegistry::stopAll()

source/FeatureRegistry.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ namespace Aws
7777
};
7878

7979
} // namespace Util
80-
} // namespace DeviceClient
81-
} // namespace Iot
80+
} // namespace DeviceClient
81+
} // namespace Iot
8282
} // namespace Aws
8383

8484
#endif // AWS_IOT_DEVICE_CLIENT_FEATURE_REGISTRY_H

source/SharedCrtResourceManager.cpp

+12-8
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ int SharedCrtResourceManager::buildClient(const PlainConfig &config)
227227
"logging::enable-sdk-logging in your configuration file");
228228
}
229229

230-
eventLoopGroup = unique_ptr<EventLoopGroup>(
231-
new EventLoopGroup(1 // The number of threads used depends on your use-case. IF you have a maximum of less than
232-
// a few hundred connections 1 thread is the ideal threadCount.
233-
));
230+
eventLoopGroup = unique_ptr<EventLoopGroup>(new EventLoopGroup(
231+
1 // The number of threads used depends on your use-case. IF you have a maximum of less than
232+
// a few hundred connections 1 thread is the ideal threadCount.
233+
));
234234
if (!eventLoopGroup)
235235
{
236236
// cppcheck-suppress nullPointerRedundantCheck
@@ -394,7 +394,8 @@ int SharedCrtResourceManager::establishConnection(const PlainConfig &config)
394394
* This will execute when an mqtt connect has completed or failed.
395395
*/
396396
auto onConnectionCompleted = [this, &connectionCompletedPromise](
397-
const Mqtt::MqttConnection &, int errorCode, Mqtt::ReturnCode returnCode, bool) {
397+
const Mqtt::MqttConnection &, int errorCode, Mqtt::ReturnCode returnCode, bool)
398+
{
398399
if (errorCode)
399400
{
400401
LOGM_ERROR(TAG, "MQTT Connection failed with error: %s", ErrorDebugString(errorCode));
@@ -418,7 +419,8 @@ int SharedCrtResourceManager::establishConnection(const PlainConfig &config)
418419
/*
419420
* Invoked when a disconnect message has completed.
420421
*/
421-
auto onDisconnect = [this](const Mqtt::MqttConnection & /*conn*/) {
422+
auto onDisconnect = [this](const Mqtt::MqttConnection & /*conn*/)
423+
{
422424
{
423425
LOG_INFO(TAG, "MQTT Connection is now disconnected");
424426
connectionClosedPromise.set_value();
@@ -428,7 +430,8 @@ int SharedCrtResourceManager::establishConnection(const PlainConfig &config)
428430
/*
429431
* Invoked when connection is interrupted.
430432
*/
431-
auto OnConnectionInterrupted = [this](const Mqtt::MqttConnection &, int errorCode) {
433+
auto OnConnectionInterrupted = [this](const Mqtt::MqttConnection &, int errorCode)
434+
{
432435
{
433436
if (errorCode)
434437
{
@@ -444,7 +447,8 @@ int SharedCrtResourceManager::establishConnection(const PlainConfig &config)
444447
/*
445448
* Invoked when connection is resumed.
446449
*/
447-
auto OnConnectionResumed = [this](const Mqtt::MqttConnection &, int returnCode, bool) {
450+
auto OnConnectionResumed = [this](const Mqtt::MqttConnection &, int returnCode, bool)
451+
{
448452
{
449453
LOGM_INFO(TAG, "MQTT connection resumed with return code: %d", returnCode);
450454
}

source/SharedCrtResourceManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ namespace Aws
103103
void dumpMemTrace();
104104
};
105105
} // namespace DeviceClient
106-
} // namespace Iot
106+
} // namespace Iot
107107
} // namespace Aws
108108

109109
#endif // DEVICE_CLIENT_SHAREDCRTRESOURCEMANAGER_H

source/config/Config.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,6 @@ constexpr char PlainConfig::ConfigShadow::JSON_ENABLE_CONFIG_SHADOW[];
18851885
constexpr char PlainConfig::ConfigShadow::CLI_ENABLE_CONFIG_SHADOW[];
18861886
constexpr char PlainConfig::ConfigShadow::JSON_CONFIG_SHADOW_PERSISTENT_UPDATE[];
18871887

1888-
18891888
bool PlainConfig::ConfigShadow::LoadFromJson(const Crt::JsonView &json)
18901889
{
18911890
const char *jsonKey = JSON_ENABLE_CONFIG_SHADOW;
@@ -2894,7 +2893,8 @@ bool Config::ParseConfigFile(const string &file, ConfigFileType configFileType)
28942893
}
28952894

28962895
#if !defined(DISABLE_MQTT)
2897-
LOGM_INFO(TAG, "Successfully fetched JSON config file from %s : %s", expandedPath.c_str(), Sanitize(contents).c_str());
2896+
LOGM_INFO(
2897+
TAG, "Successfully fetched JSON config file from %s : %s", expandedPath.c_str(), Sanitize(contents).c_str());
28982898
#endif
28992899
setting.close();
29002900

source/config/Config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ namespace Aws
541541
static bool ExportDefaultSetting(const std::string &file);
542542
};
543543
} // namespace DeviceClient
544-
} // namespace Iot
544+
} // namespace Iot
545545
} // namespace Aws
546546

547547
#endif // DEVICE_CLIENT_CONFIG_H

source/devicedefender/DeviceDefenderFeature.cpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ int DeviceDefenderFeature::stop()
8383
std::shared_ptr<AbstractReportTask> DeviceDefender::DeviceDefenderFeature::createReportTask()
8484
{
8585

86-
auto onCancelled = [this](void *userData) -> void {
86+
auto onCancelled = [this](void *userData) -> void
87+
{
8788
LOGM_DEBUG(TAG, "task called onCancelled for thing: %s", thingName.c_str());
8889
stop();
8990
};
@@ -106,12 +107,10 @@ std::shared_ptr<AbstractReportTask> DeviceDefender::DeviceDefenderFeature::creat
106107
}
107108
void DeviceDefender::DeviceDefenderFeature::subscribeToTopicFilter()
108109
{
109-
auto onRecvData = [](const MqttConnection &, const String &topic, const ByteBuf &payload) -> void {
110-
LOGM_DEBUG(TAG, "Recv: Topic:(%s), Payload:%s", topic.c_str(), reinterpret_cast<char *>(payload.buffer));
111-
};
112-
auto onSubAck = [this](const MqttConnection &, uint16_t, const String &, QOS, int errorCode) -> void {
113-
LOGM_DEBUG(TAG, "SubAck: PacketId:(%s), ErrorCode:%i", getName().c_str(), errorCode);
114-
};
110+
auto onRecvData = [](const MqttConnection &, const String &topic, const ByteBuf &payload) -> void
111+
{ LOGM_DEBUG(TAG, "Recv: Topic:(%s), Payload:%s", topic.c_str(), reinterpret_cast<char *>(payload.buffer)); };
112+
auto onSubAck = [this](const MqttConnection &, uint16_t, const String &, QOS, int errorCode) -> void
113+
{ LOGM_DEBUG(TAG, "SubAck: PacketId:(%s), ErrorCode:%i", getName().c_str(), errorCode); };
115114
resourceManager->getConnection()->Subscribe(
116115
FormatMessage(TOPIC_FORMAT, TOPIC_PRE, thingName.c_str(), TOPIC_POST, TOPIC_ACCEPTED).c_str(),
117116
AWS_MQTT_QOS_AT_LEAST_ONCE,
@@ -125,9 +124,8 @@ void DeviceDefender::DeviceDefenderFeature::subscribeToTopicFilter()
125124
}
126125
void DeviceDefender::DeviceDefenderFeature::unsubscribeToTopicFilter()
127126
{
128-
auto onUnsubscribe = [](const MqttConnection &, uint16_t packetId, int errorCode) -> void {
129-
LOGM_DEBUG(TAG, "Unsubscribing: PacketId:%i, ErrorCode:%i", packetId, errorCode);
130-
};
127+
auto onUnsubscribe = [](const MqttConnection &, uint16_t packetId, int errorCode) -> void
128+
{ LOGM_DEBUG(TAG, "Unsubscribing: PacketId:%i, ErrorCode:%i", packetId, errorCode); };
131129
resourceManager->getConnection()->Unsubscribe(
132130
FormatMessage(TOPIC_FORMAT, TOPIC_PRE, thingName.c_str(), TOPIC_POST, TOPIC_ACCEPTED).c_str(), onUnsubscribe);
133131
resourceManager->getConnection()->Unsubscribe(

source/devicedefender/DeviceDefenderFeature.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ namespace Aws
141141
virtual void unsubscribeToTopicFilter();
142142
};
143143
} // namespace DeviceDefender
144-
} // namespace DeviceClient
145-
} // namespace Iot
144+
} // namespace DeviceClient
145+
} // namespace Iot
146146
} // namespace Aws
147147

148148
#endif // DEVICE_CLIENT_DEVICEDEFENDERFEATURE_H

source/devicedefender/ReportTaskWrapper.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ namespace Aws
4646
std::shared_ptr<Aws::Iotdevicedefenderv1::ReportTask> task;
4747
};
4848
} // namespace DeviceDefender
49-
} // namespace DeviceClient
50-
} // namespace Iot
49+
} // namespace DeviceClient
50+
} // namespace Iot
5151
} // namespace Aws
5252

5353
#endif // AWS_IOT_DEVICE_CLIENT_REPORTTASKWRAPPER_H

0 commit comments

Comments
 (0)