This commit is contained in:
Oguz Bastemur 2018-05-07 13:53:23 -07:00
Родитель 148648f8b7
Коммит d41758a3fb
5 изменённых файлов: 64 добавлений и 58 удалений

Просмотреть файл

@ -6,25 +6,25 @@
Full implementation of a device firmware for Azure IoT Central
Implements the following features:
Simple onboarding via a web UX
Simple device reset (press and hold the A & B buttons at the same time)
Display shows count of messages, errors, twin events, network information, and device name (cycle through screens with B button)
Telemetry sent for all onboard sensors (configurable)
State change telemetry sent when button A pressed and the device cycles through the three states (NORMAL, CAUTION, DANGER)
Reported twin property sent for double tap of device (uses accelerometer sensor data)
Desired twin property to simulate turning on a fan (fan sound plays from onboard headphone jack)
Cloud to device messages (supports sending a message to display on the screen)
Direct twin method calls (supports asking the device to play a rainbow sequence on the RGB LED)
LED status of network, Azure IoT send events, Azure IoT error events, and current device state (NORMAL=green, CAUTION=amber, DANGER=red)
Simple onboarding via a web UX
Simple device reset (press and hold the A & B buttons at the same time)
Display shows count of messages, errors, twin events, network information, and device name (cycle through screens with B button)
Telemetry sent for all onboard sensors (configurable)
State change telemetry sent when button A pressed and the device cycles through the three states (NORMAL, CAUTION, DANGER)
Reported twin property sent for double tap of device (uses accelerometer sensor data)
Desired twin property to simulate turning on a fan (fan sound plays from onboard headphone jack)
Cloud to device messages (supports sending a message to display on the screen)
Direct twin method calls (supports asking the device to play a rainbow sequence on the RGB LED)
LED status of network, Azure IoT send events, Azure IoT error events, and current device state (NORMAL=green, CAUTION=amber, DANGER=red)
Uses the following libraries:
Libraries installed by the MXChip IoT DevKit (https://microsoft.github.io/azure-iot-developer-kit/):
AureIoTHub - https://github.com/Azure/azure-iot-arduino
AzureIoTUtility - https://github.com/Azure/azure-iot-arduino-utility
AzureIoTProtocol_MQTT - https://github.com/Azure/azure-iot-arduino-protocol-mqtt
Libraries installed by the MXChip IoT DevKit (https://microsoft.github.io/azure-iot-developer-kit/):
AureIoTHub - https://github.com/Azure/azure-iot-arduino
AzureIoTUtility - https://github.com/Azure/azure-iot-arduino-utility
AzureIoTProtocol_MQTT - https://github.com/Azure/azure-iot-arduino-protocol-mqtt
Third party libraries used:
Parson ( http://kgabis.github.com/parson/ ) Copyright (c) 2012 - 2017 Krzysztof Gabis
Third party libraries used:
Parson ( http://kgabis.github.com/parson/ ) Copyright (c) 2012 - 2017 Krzysztof Gabis
***/

Просмотреть файл

@ -45,7 +45,7 @@ bool ApplicationController::loop() {
initialize();
}
if (Globals::loopController != NULL) {
if (Globals::loopController != NULL) {
Globals::loopController->loop();
}
}

Просмотреть файл

@ -1,20 +1,23 @@
The MIT License (MIT)
azure-iot-central-firmware
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the Software), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject
to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Просмотреть файл

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license.
# Licensed under the MIT license.
import time
import json
@ -226,7 +226,7 @@ def accelerometerStart():
x = acceleration['x']
y = acceleration['y']
z = acceleration['z']
x = abs(x)
y = abs(y)
z = abs(z)
@ -251,15 +251,15 @@ def accelerometerStart():
time.sleep(0.1)
def showIPOnDisplay(showIp):
# show the IP on the display
globals.sense.clear()
# show the IP on the display
globals.sense.clear()
if showIp:
if deviceState.getIPaddress()[0] != "127.0.0.1" and deviceState.getIPaddress()[0] != "0.0.0.0": # check to see if loop back or not assigned
globals.sense.show_message("Wifi IP: {0}".format(deviceState.getIPaddress()[0]), text_colour=[255,0,0])
if deviceState.getIPaddress()[1] != "127.0.0.1" and deviceState.getIPaddress()[1] != "0.0.0.0": # check to see if loop back or not assigned
globals.sense.show_message("Ethernet IP: {0}".format(deviceState.getIPaddress()[1]), text_colour=[0,255,0])
if showIp:
if deviceState.getIPaddress()[0] != "127.0.0.1" and deviceState.getIPaddress()[0] != "0.0.0.0": # check to see if loop back or not assigned
globals.sense.show_message("Wifi IP: {0}".format(deviceState.getIPaddress()[0]), text_colour=[255,0,0])
if deviceState.getIPaddress()[1] != "127.0.0.1" and deviceState.getIPaddress()[1] != "0.0.0.0": # check to see if loop back or not assigned
globals.sense.show_message("Ethernet IP: {0}".format(deviceState.getIPaddress()[1]), text_colour=[0,255,0])
def main():
#initialize logging
logger.init()
@ -269,16 +269,16 @@ def main():
# initialize globals
globals.init()
wlan0Ip = utility.getIpAddress('wlan0')
eth0Ip = utility.getIpAddress('eth0')
if configState.config["hubConnectionString"] == "":
deviceState.init("", globals.firmwareVersion)
deviceState.setIPaddress(wlan0Ip, eth0Ip)
showIPOnDisplay(True)
webServerStart(8080)
else:
# initialize device state

Просмотреть файл

@ -1,20 +1,23 @@
The MIT License (MIT)
azure-iot-central-firmware
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the Software), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject
to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.