Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
Device Client bug fixes for (1)reboot action, (2)Docker images and (3…
Browse files Browse the repository at this point in the history
…)DC versioning (awslabs#210)

* Bug fix for reboot action.

* Updated docker images and DC version

* Indentation error

* Indentation error
  • Loading branch information
HarshGandhi-AWS authored Jan 4, 2022
1 parent 7755cfc commit 2790c41
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/docker-images/ubi8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ WORKDIR /home/aws-iot-device-client
RUN mkdir sdk-cpp-workspace \
&& cd sdk-cpp-workspace \
&& git clone https://github.com/aws/aws-iot-device-sdk-cpp-v2.git \
&& cd aws-iot-device-sdk-cpp-v2 \
&& git checkout a73593d1003e2b231c6db53710aa6c75d8196b1f \
&& git submodule update --init --recursive \
&& cd .. \
Expand Down
1 change: 1 addition & 0 deletions .github/docker-images/ubuntu-16-x64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ WORKDIR /home/aws-iot-device-client
RUN mkdir sdk-cpp-workspace \
&& cd sdk-cpp-workspace \
&& git clone https://github.com/aws/aws-iot-device-sdk-cpp-v2.git \
&& cd aws-iot-device-sdk-cpp-v2 \
&& git checkout a73593d1003e2b231c6db53710aa6c75d8196b1f \
&& git submodule update --init --recursive \
&& cd .. \
Expand Down
1 change: 1 addition & 0 deletions sample-job-handlers/reboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ else
date "+%s" > $REBOOT_LOCK_FILE
reboot || true
rm $REBOOT_LOCK_FILE
exit 1
fi
fi
3 changes: 2 additions & 1 deletion source/SharedCrtResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "SharedCrtResourceManager.h"
#include "Version.h"
#include "logging/LoggerFactory.h"
#include "util/FileUtils.h"
#include "util/Retry.h"
Expand Down Expand Up @@ -235,7 +236,7 @@ int SharedCrtResourceManager::establishConnection(const PlainConfig &config)
clientConfigBuilder.WithEndpoint(config.endpoint->c_str());
clientConfigBuilder.WithCertificateAuthority(config.rootCa->c_str());
clientConfigBuilder.WithSdkName(SharedCrtResourceManager::BINARY_NAME);
clientConfigBuilder.WithSdkVersion(SharedCrtResourceManager::BINARY_VERSION);
clientConfigBuilder.WithSdkVersion(DEVICE_CLIENT_VERSION);

auto clientConfig = clientConfigBuilder.Build();

Expand Down
13 changes: 12 additions & 1 deletion source/SharedCrtResourceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ namespace Aws
private:
const char *TAG = "SharedCrtResourceManager.cpp";
const char *BINARY_NAME = "IoTDeviceClient";
const char *BINARY_VERSION = "1.2";

static constexpr int DEFAULT_WAIT_TIME_SECONDS = 10;
bool initialized = false;
Expand All @@ -45,8 +44,11 @@ namespace Aws
std::vector<Feature *> *features;

bool locateCredentials(const PlainConfig &config);

bool setupLogging(const PlainConfig &config);

int buildClient(const PlainConfig &config);

void initializeAllocator();

public:
Expand All @@ -61,14 +63,23 @@ namespace Aws
static const int SUCCESS = 0;
static const int RETRY = 1;
static const int ABORT = 2;

bool initialize(const PlainConfig &config, std::vector<Feature *> *features);

void initializeAWSHttpLib();

int establishConnection(const PlainConfig &config);

void startDeviceClientFeatures();

std::shared_ptr<Crt::Mqtt::MqttConnection> getConnection();

Aws::Crt::Io::EventLoopGroup *getEventLoopGroup();

struct aws_allocator *getAllocator();

Aws::Crt::Io::ClientBootstrap *getClientBootstrap();

void disconnect();
};
} // namespace DeviceClient
Expand Down
6 changes: 2 additions & 4 deletions source/Version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#ifndef AWS_IOT_DEVICE_CLIENT_VERSION_H
#define AWS_IOT_DEVICE_CLIENT_VERSION_H

#define DEVICE_CLIENT_VERSION_FULL @aws-iot-device-client_VERSION_STRING_FULL@
#define DEVICE_CLIENT_VERSION_MAJOR @aws-iot-device-client_VERSION_MAJOR@
#define DEVICE_CLIENT_VERSION_MINOR @aws-iot-device-client_VERSION_MINOR@
#define DEVICE_CLIENT_VERSION_PATCH @aws-iot-device-client_VERSION_PATCH@
#define DEVICE_CLIENT_VERSION_FULL "@aws-iot-device-client_VERSION_STRING_FULL@"
#define DEVICE_CLIENT_VERSION "@aws-iot-device-client_VERSION_STRING@"

#endif // AWS_IOT_DEVICE_CLIENT_VERSION_H
23 changes: 17 additions & 6 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,45 @@
#include "util/Retry.h"

#if !defined(EXCLUDE_DD)

# include "devicedefender/DeviceDefenderFeature.h"

#endif
#if !defined(EXCLUDE_JOBS)

# include "jobs/JobsFeature.h"

#endif
#if !defined(EXCLUDE_FP)

# include "fleetprovisioning/FleetProvisioning.h"

#endif

#include "logging/LoggerFactory.h"

#if !defined(EXCLUDE_ST)

# include "tunneling/SecureTunnelingFeature.h"

#endif
#if !defined(EXCLUDE_SAMPLES)
# if !defined(EXCLUDE_PUBSUB)

# include "samples/pubsub/PubSubFeature.h"

# endif
#endif
#if !defined(EXCLUDE_SHADOW)
# if !defined(EXCLUDE_CONFIG_SHADOW)

# include "shadow/ConfigShadow.h"

# endif
# if !defined(EXCLUDE_SAMPLE_SHADOW)

# include "shadow/SampleShadowFeature.h"

# endif
#endif

Expand Down Expand Up @@ -276,12 +292,7 @@ int main(int argc, char *argv[])
LOG_WARN(TAG, "Unable to append current working directory to PATH environment variable.");
}

LOGM_INFO(
TAG,
"Now running AWS IoT Device Client version v%d.%d.%d",
DEVICE_CLIENT_VERSION_MAJOR,
DEVICE_CLIENT_VERSION_MINOR,
DEVICE_CLIENT_VERSION_PATCH);
LOGM_INFO(TAG, "Now running AWS IoT Device Client version %s", DEVICE_CLIENT_VERSION_FULL);

// Register for listening to interrupt signals
sigset_t sigset;
Expand Down

0 comments on commit 2790c41

Please sign in to comment.