gdsc-hsu / gateway Goto Github PK
View Code? Open in Web Editor NEW[Top 3] 2022 Solution Challenge an IoT apporch include Flutter & embedded devices, network protocol, solving/helping covid-19 situation
License: MIT License
[Top 3] 2022 Solution Challenge an IoT apporch include Flutter & embedded devices, network protocol, solving/helping covid-19 situation
License: MIT License
Motion not present in area toggle turn off running services camera
, ml_kit
, faceMask
and showing off the advertisement
AS BLE Device scanning the area it will detect whether motion been detected and transfer the data If motion been detected BLE board will send the data over BLE formatted as String and decode into:
# string => bool
true: Motion is detected
false: No Motion has been detected
Specification
Note
Dependency : #11 when user already has the organization endpoint
The functionality is allow organization to add the device(mobile) and configure device information into their
organization for device management.
System actor : Mobile, Web
Organization on their Web dashboard and create new device (without any information), only has the QRCode encoded with the device-assess-key, When Mobile scan the QRCode so that it could claim(device-assess-key) the created device and upload it information to the organization.
New device are created with the organization with the following information [x]. When device are added susses-fully organization are able to modify their changeable information
This bellow information will be saved to the mobile app (local data) and use for device authentication.
[x] device information
Device name: string -changeable
Device location: string
(Name of streets, school campus location or custom markup, GPS stamp) -changeable
Device unique id: string
(user for api parameter)
Device assess key: string
Device MAC address: string
Tag: array of string
(Device tag for query, filter purpose) -changeable
Device authentication only use device-assess-key , device-id, device-mac
Hardware information data : MAC address
Specification
How device claim work
Note
After login users will get their organization (GET /organization) follow the status code
200 meaning they have been in an organization we route them to the dashboard page
In dashboard page showing their organization name in the navbar
Route them to "Device Management Page" as default when go in to dashboard
Here are some detail about MQTT, blog post could help you research an solution
MQTT allows client to connect to broker with (username, password).
MQTT protocol has session, and Qos level. Meaning that the broker know when device has been disconnected
(copy form) MQTT Last Will and Testament (LWT): when the MQTT broker detects that the client is no longer connected it will publish the LWT message to the configured topic (note LWT is configured on the remote client, not in OH). Then create a switch Item to subscribe for those LWT messages and flip it off when you see a LWT message and back ON when you see any other message (use a rule).
LWT vietnamese blog (thông báo cho các khách hàng khác về một khách hàng bị ngắt kết nối một cách vô duyên.) : https://vidieukhien.xyz/2020/03/22/mqtt-tutorial-mqtt-last-will-and-testament/
LWT best practice https://www.hivemq.com/blog/mqtt-essentials-part-9-last-will-and-testament/
Flutter LWT : implement link
Topic for status : org/{org-name}/device/{device-id}/status.
Requirement for near realtime is not required (heart-beat or ping is okie).
Google Cloud Solution
GCP has a solution for it: https://stackoverflow.com/questions/54609757/google-core-iot-device-offline-event-or-connection-status , but it has required Stackdirver(GCP monitor tool) to monitor IoT_Core for device disconnection
relatied to GCP solution :
persistent-device-connection-status
google-cloud-detecting-offline-devices
Stuff has been proved
Using an UI-libary nebular. I suggest nebular-iot-dash-board.
We will use UI library component to design our web dashboard.
Firebase Auth for login/register
Firebase firestore: to monitor device status in near realtime
Using sidebar to navigate to each web page.
# sample routing schema. modify as you will
/: "Home Page"
/login: " Login Page"
/signup: "Sign up Page"
/device/{id}: "Device Detail Page"
/device/management: "Device Management Page"
/device/new: "Create new device"
/organization/new : "Create Organization Page"
To create device users have to type in their device information when they are finished they are able to submit the form.
When the form is submitted and successful they will see their device status and their device configured QR code.
Page allows the user to sign in with an Email & Password
If they don't have an account they could create their account.
branch name : "feature-org-preview"
Organization could do statistic query data over device log.
Organization on the web could see log for current device by #12.
Log are too large for them to look at, they are able to make query like to find or locate device log they wanted. The data response back will be device log located at #13
Note : Query 1,2 are not combine only use one or another
URL:/{device-id}/________
Specification
Note
The functionality allows user when they configure their device into their organization dashboard as return they will have their device credential, after the app re-open the app could be able to re-config themselves with saved credential without having to re-configure manually.
Note
Base on [UI DOCS] #31
Estimate : 04/03/2022
This functionality allow organization to view device detail ([device information] #12) by doing so they could see the [data has been log] #13 further on organization could make query on those data.
Use-case 1 : view device detail
Organization on the web app could view the device information by make query to device-id, these are the data they will get
[Model for device information #12]
Use-case 2 view device data log
After the organization has the view detail of the device they has an option to view data.
Data pull form the backend will have 2 options (stateless, state-full).
[Model for data log #13]
Specification
Those are the data required when user interaction with the core function of the app.
BLE GATT
for gateway checkBLE
connection to sensorBLE GATT : https://github.com/GDSC-HSU/gateway/blob/master/lib/config/constants/ble_desgin_constants.g.dart
Device scanning: this functionality allows the user to scan the IoT device, UI should be clear to indicate which step the user is currently in. After the device being scanned successful, the functionality will transfer the scanned result in order to establish Flutter to IoT device via ble connection.
[App-state]
[App-GUI] spectification
UI element required to indicate user base on state behavior
User able to create their organization, and following on using the rest of the backend api belong to their created organization
Web client after they log in with email, password. If they are not participating in an organization they have an option to create an organization.
When an organization is created successfully, they will be able to use their organization endpoint
"https://{our_project_domain}/org/{organization_id}/"
organization_name: "Google Developer Student Clubs of Hoa Sen university"
organization_img: "xxx-xxxx-xxxx.jpeg"
organization_endpoint : "https://{our_project_domain}/org/{organization_id}/"
organization_id: "gdsc-hsu"
*Note:
Specification
Note
The functionality allow device (mobile) to transfer their data into organization backend. Later they could gather the data or make query or filter on it.
The device (mobile) app after each person interact their data [x] will be transfer to organization backend.
Header: device access token
[x]
body_temperature : float
face_mask: bool
covid_identification:
identification_method: QR | RFID
identification_data : string
is_complete : bool (indicate weather user completing all the step, or they just do covid_identification)
Timestamp:
Note:
Specification
Note
Allow users to see all their device belong to their orgnaization.
Some noted in table nice to have
The functionality base on the following DeviceScan the valid device when scanning complete will move on to establish the ble connection
#### Rules
1. Device has to be valid (be programmed by ours)
2. Device has to turn on and broadcast BLE single
[App-state]
[App-UI]
UI3 -> U2
\UI1/
An organization able to monitor device status (online , offline)
As devices (mobile_app) are working organizations want to check the device connection status. So that they could identify in real-time does the device is still functional (online) or has been shut down (offline).
#19 After doing research we are using MQTT for this feature.
Ex: Firestore collection
var device_connection = firestore.col("device-status").col("device-id").{}
Ex: Stored object
status: offline|online
timespan: int "Based on this we could know what time does the device has been in those statuses"
Automate, clicking use for emulator BLE Sensor been measure by ESP32 (using real IoT-sensor to do those steps are harshh 😢 )
YMAL example
gatt_profile:
- BLE_SERVICE_PROXIMITY_UUID : "00000A00-5226-4AE0-8977-656FD3C42DA2"
- BLE_CHARACTERISTIC_PROXIMITY_DISTANCE: "00000A02-5226-4AE0-8977-656FD3C42DA2"
Documentation how you guys set up your required environment to begin development process.
This will include how we could mock other process by each teem.
Note:
Logic, business flow implementation
estimate: 25/2
HMW DESIGN AN ARCHITECTURE ALLOW USER SELFT-HOST OURS OPEN-SOURCE
Base on the discussion we're having ours (architecture)solution will enable user self-host ours open source architecture with an GCP
Requirements
=> After Mobile app successful find the backend self-host, and establish with backend device access key (device-id). The mobile app(device) will belong to the backend self-hosted (organization).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.