Helps simplify the work needed to control the process flow for updating firmware in node.js when using Azure IoT Hub
npm install az-firmware-updater
You will need an existing Azure IoT Hub.
To use the firmware updater on your client device (see samples for a complete solution):
const Protocol = require('azure-iot-device-mqtt').Mqtt;
const Client = require('azure-iot-device').Client;
const FirmwareUpdater = require('az-firmware-updater');
const client = Client.fromConnectionString('your-connection-string', Protocol);
client.open(function (err) {
if (err) {
console.log(`client error: ${err}`);
} else {
console.log('client connected.');
const options = {
applyImage: function (imageName) {
return new Promise(function (fulfill, reject) {
// put your custom apply logic here.
setTimeout(function () {
console.log(`Applied the image: ${imageName}`);
fulfill();
}, 4000);
});
}
}
const firmwareUpdater = new FirmwareUpdater(client, options);
client.onDeviceMethod('firmwareUpdate', function (request, response) {
response.send(200, 'Firmware update started.');
firmwareUpdater.initiateFirmwareUpdateFlow(request.payload.firmwareUrl, function (err) {
if (err) {
console.log("firmware update failed");
} else {
console.log("Completed firmwareUpdate flow");
}
});
});
}
});
There are many options you can overload. Docs coming soon.
echo -n | openssl s_client -connect <your-url>:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > cert.pem
openssl x509 -noout -in cert.pem -fingerprint