Skip to content

Commit 19c1668

Browse files
authored
Merge pull request #88 from sixfab/dev
release: version 0.2.0
2 parents 28bef9b + 9adf4b0 commit 19c1668

File tree

100 files changed

+10986
-3669
lines changed

Some content is hidden

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

100 files changed

+10986
-3669
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ cert/
44
### Configs
55
config.json
66

7+
### VSCode Config
8+
.vscode/
9+
10+
### Mock modules
11+
machine.py
12+
neopixel.py
13+
ubinascii.py
14+
micropython.py
15+
pyb.py
16+
717
### PYTHON
818
# Byte-compiled / optimized / DLL files
919
__pycache__/
@@ -57,6 +67,8 @@ coverage.xml
5767
.hypothesis/
5868
.pytest_cache/
5969
cover/
70+
test.json
71+
pytest.ini
6072

6173
# Translations
6274
*.mo
@@ -127,6 +139,8 @@ celerybeat.pid
127139
*.sage.py
128140

129141
# Environments
142+
bin/
143+
pyvenv.cfg
130144
.env
131145
.venv
132146
env/

.vscode/settings.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

CONFIGURATIONS.md

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# Configuration Files
2+
Each application module designed to work with configuration files for easier manipulation to server-side changes. A configuration file is named as `config.json` and stores necessary connection parameters which are designed for you to easily connect to the applications.
3+
4+
In this file, you can find example configuration files for each application module and their mandatory and optional parameters. This file must be placed on the root directory of PicoLTE module.
5+
6+
## Table of Contents
7+
1. [Amazon Web Services IoT Core](#amazon-web-services-iot-core-configurations)
8+
2. [Microsoft Azure IoT Hub](#microsoft-azure-iot-hub-configurations)
9+
3. [Slack](#slack-configurations)
10+
4. [Telegram](#telegram-configurations)
11+
5. [ThingSpeak™](#thingspeak-configurations)
12+
6. [Native HTTPS](#https-configurations)
13+
7. [Native MQTTS](#mqtts-configurations)
14+
8. [Configuration Files for Your Own Application Module](#configuration-files-for-your-own-application-module)
15+
16+
## Applications
17+
In this section, we're going to give you better understanding about how to create a `config.json` file for specific application modules.
18+
19+
### Amazon Web Services IoT Core Configurations
20+
You can select MQTTS or HTTPS protocol and delete the other attribute.
21+
```json
22+
{
23+
"aws": {
24+
"mqtts": {
25+
"host": "[YOUR_AWSIOT_ENDPOINT]",
26+
"port": "[YOUR_AWSIOT_MQTT_PORT]",
27+
"pub_topic": "[YOUR_MQTT_TOPIC]",
28+
"sub_topics": [
29+
"[YOUR_MQTT_TOPIC/1]",
30+
"[YOUR_MQTT_TOPIC/2]"
31+
]
32+
},
33+
34+
"https": {
35+
"endpoint": "[YOUR_AWS_IOT_ENDPOINT]",
36+
"topic": "[YOUR_DEVICE_TOPIC]"
37+
}
38+
}
39+
}
40+
```
41+
42+
### Microsoft Azure IoT Hub Configurations
43+
Within this level of configurations, you can use Azure IoT Hub directly.
44+
```json
45+
{
46+
"azure": {
47+
"hub_name": "[YOUR_IOT_HUB_NAME]",
48+
"device_id": "[YOUR_DEVICE_ID]"
49+
}
50+
}
51+
```
52+
For more detailed configuration, you may want to use extra MQTTS parameters. Each attribute in MQTTS is optional.
53+
```json
54+
{
55+
"azure": {
56+
"hub_name": "[YOUR_IOT_HUB_NAME]",
57+
"device_id": "[YOUR_DEVICE_ID]",
58+
"mqtts": {
59+
"host":"[YOUR_MQTT_HOST]",
60+
"port":"[YOUR_MQTT_PORT]",
61+
"pub_topic":"[YOUR_MQTT_PUB_TOPIC]",
62+
"sub_topics":[
63+
["[YOUR_MQTT_TOPIC/1]",[QOS]],
64+
["[YOUR_MQTT_TOPIC/2]",[QOS]]
65+
],
66+
"username":"[YOUR_MQTT_USERNAME]",
67+
"password":"[YOUR_MQTT_PASSWORD]"
68+
}
69+
}
70+
}
71+
```
72+
73+
### Slack Configurations
74+
To connect Slack, only need is a WebHook URL, there is no more detailed attributes.
75+
76+
```json
77+
{
78+
"slack":{
79+
"webhook_url": "[INCOMING_WEBHOOK_URL]"
80+
}
81+
}
82+
```
83+
84+
### Telegram Configurations
85+
Within this level of configurations, you can use Telegram directly.
86+
```json
87+
{
88+
"telegram": {
89+
"token": "[YOUR_BOT_TOKEN_ID]",
90+
"chat_id": "[YOUR_GROUP_CHAT_ID]"
91+
}
92+
}
93+
```
94+
In case of future server URL changes in Telegram side, you may want to add `server` attribute as shown below.
95+
```json
96+
{
97+
"telegram": {
98+
"server": "[TELEGRAM_BOT_API_ENDPOINT]",
99+
"token": "[YOUR_BOT_TOKEN_ID]",
100+
"chat_id": "[YOUR_GROUP_CHAT_ID]"
101+
}
102+
}
103+
```
104+
105+
106+
### ThingSpeak Configurations
107+
Within this level of configurations, you can use ThingSpeak directly. Subscription and publish operations are made directly to all channel fields.
108+
```json
109+
{
110+
"thingspeak": {
111+
"channel_id": "[YOUR_CHANNEL_ID]",
112+
"mqtts": {
113+
"client_id": "[DEVICE_MQTT_CLIENT_ID]",
114+
"username": "[DEVICE_MQTT_USERNAME]",
115+
"password": "[DEVICE_MQTT_PASSWORD]"
116+
}
117+
}
118+
}
119+
```
120+
For better control on which fields to subscribe or publish, you may want to add extra attributes. Also, please note that host and port address can be change by its own attributes.
121+
```json
122+
{
123+
"thingspeak": {
124+
"channel_id": "[YOUR_CHANNEL_ID]",
125+
"mqtts": {
126+
"host": "[THINGSPEAK_HOST_ADDRESS]",
127+
"port": "[THINGSPEAK_PORT_ADDRESS]",
128+
"client_id": "[DEVICE_MQTT_CLIENT_ID]",
129+
"username": "[DEVICE_MQTT_USERNAME]",
130+
"password": "[DEVICE_MQTT_PASSWORD]",
131+
"sub_topics": [
132+
["[YOUR_MQTT_TOPIC]", [QOS]]
133+
],
134+
"pub_topic": "[YOUR_MQTT_TOPIC]"
135+
}
136+
}
137+
}
138+
```
139+
## Modules
140+
Some use-cases can be implemented by using modules when there is no spesific application for that use-case. In this situtations, the developers can built their own solutions with using HTTPS and MQTTS modules.
141+
142+
### HTTPS Configurations
143+
```json
144+
{
145+
"https": {
146+
"server": "[HTTP_SERVER]",
147+
"username": "[YOUR_HTTP_USERNAME]",
148+
"password": "[YOUR_HTTP_PASSWORD]"
149+
}
150+
}
151+
```
152+
### MQTTS Configurations
153+
```json
154+
{
155+
"mqtts": {
156+
"host": "[YOUR_MQTT_HOST]",
157+
"port": "[YOUR_MQTT_PORT]",
158+
"pub_topic": "[YOUR_MQTT_PUB_TOPIC]",
159+
"sub_topics": [
160+
["[YOUR_MQTT_TOPIC/1]",[QOS]],
161+
["[YOUR_MQTT_TOPIC/2]",[QOS]]
162+
],
163+
"username": "[YOUR_MQTT_USERNAME]",
164+
"password": "[YOUR_MQTT_PASSWORD]"
165+
}
166+
```
167+
168+
## Configuration Files for Your Own Application Module
169+
The most important feature that we've developed in PicoLTE SDK is the ability to create new applications for your specific services. Please refer to [CONTRIBUTING.md](./CONTRIBUTING.md) guidelines. You need to follow standarts that we used to create an application configuration parameters.
170+
171+
This is the general structure of a `config.json` file:
172+
```
173+
{
174+
"your_own_app": {
175+
[application_specific_attributes],
176+
// If the connection made with MQTTS:
177+
"mqtts": {
178+
"host": "",
179+
"port": "",
180+
"pub_topic": "",
181+
"sub_topics": [
182+
["", [QOS]],
183+
["", [QOS]]
184+
],
185+
"username": "",
186+
"password": ""
187+
},
188+
// If the connection made with HTTPS:
189+
"https": {
190+
"server": "",
191+
"username": "",
192+
"password": ""
193+
}
194+
}
195+
}
196+
```
197+
In case of redundant parameter in MQTTS or HTTPS, you can remove it from the structure.

CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Contributing
2+
3+
Thank you so much for your interest in contributing. All types of contributions are encouraged and valued. All you need to do is read the guidelines before making any chances!
4+
5+
## Request Support/Feature or Report an Error
6+
If you have a problem with the SDK or you want a well-thought-out feature, please open an issue and provide all the information regarding your problem or idea. You don't need to label your own issue, the code maintainers will handle this job. If it is a problem, we're going to solve it as soon as possible.
7+
8+
## Code Contribution
9+
Before implementing your own solution or solving an issue, please read the following guidelines to have a better-looking and unified code:
10+
* **Always follow PEP-8**. The codes without proper styling is not going to be merged.
11+
* **Check your code with a linter before creating a pull request**. We're strongly recommending you to use a Python linter software to check your code before submitting it.
12+
* **Provide meaningful and standardized commit messages**. We have no rush to think about commit messages, since the project collaborators are all individual people, we have to stay on a standardized system. Please only use `feat`, `refactor`, `fix`, `docs`, and `chore`.
13+
* **Make lots of commits**! You don't need to worry about commit count of your pull request since we use squash and merge method. It is better to have more and meaningfully small commits instead of big breaking changes.
14+
* **Check the code on your PicoLTE device**. Do not forget that we are working on embedded devices. You may think that you've done a little change, but in the world of tiny things, the little changes can go giant! Run your code on a PicoLTE, and report the outputs or status on your pull request.
15+
* **Follow the commit message standards on pull requests' titles**. Clear titles as important as clear commits.
16+
* **Provide necessary information on your pull request**. "Why did you do this change, is it a feature, or a bug-fix? How does it change the previous code? Do we need to refactor something else? What are the successful results?" Don't let us have questions in our minds. Provide a well-written documentation about your change.
17+
18+
## Creating a Service as Application
19+
We encourage you to create your own applications to the services if they are not available built-in since the idea behind this project is to make easy connections on many services with using cellular. To follow this mission, we need to support more services.
20+
21+
A small and simple guide given to you, developers, [in this file](examples/__sdk__/create_your_own_method.py) about how to create your own application using state manager model.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Sixfab Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<p align="center">
2+
<img src="https://community.sixfab.com/uploads/default/original/1X/583bd28f0c2b4967aa4c275f8d388f536bc9da3d.png" height="60">
3+
<h1 align="center">PicoLTE SDK for MicroPython</h1>
4+
</p>
5+
<p align="center">
6+
an embedded framework to make easier cellular connections
7+
</p>
8+
<!--
9+
-->
10+
11+
<div align="center">
12+
13+
![version](https://img.shields.io/github/package-json/v/sixfab/picocell_python-sdk?logoColor=blue&style=flat-square) ![](https://img.shields.io/badge/license-MIT-critical?style=flat-square) ![applications](https://img.shields.io/badge/applications-6%20services-success?style=flat-square) ![stars](https://img.shields.io/github/stars/sixfab/picocell_python-sdk?style=flat-square)
14+
15+
</div>
16+
17+
## Description
18+
PicoLTE SDK is a framework that you can use in your embedded systems projects and **takes care of cellular communication** processes for you. It provides built-in application support for popular back-end services such as Amazon Web Services, Azure, ThingSpeak, Slack, and Telegram.
19+
20+
* Less than 40 lines when making a connection to a built-in application.
21+
* Support for SSL/TLS certification and their secure storage.
22+
* Easy-to-use GPS, HTTPS and MQTTS interfaces.
23+
* Chance to create your own application module with state machines.
24+
25+
## Installation
26+
You can install the framework by cloning the repository to your local machine. You can also download the repository as a zip file and extract it to your local machine. After that, you can upload the `pico_lte` folder to your PicoLTE device's file system.
27+
28+
## Usage
29+
Using the framework is pretty straightforward. A `main.py` file is needed to run in a MicroPython environment, therefore, please create a `main.py` script in your PicoLTE's file system. Import the framework with `from pico_lte.core import PicoLTE` line, and code your embedded project!
30+
31+
**Note**: It is a must to have a tool to upload your `main.py` file or any example from our repository to your PicoLTE device. [Thonny IDE](https://thonny.org/) is a very common tool that has an easy GUI to perform this kind of operation. For a more compact and smaller size tool, we can recommend [Adafruit's Ampy](https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy) to you.
32+
33+
For further reference about installing or usage, please refer to our documentation page. Also, Sixfab Community Portal is available for your questions and recommendations.
34+
35+
<p align="center">
36+
<a aria-label="Documentation on Sixfab.com" href="https://docs.sixfab.com/" target="_blank">
37+
<img alt="" src="https://img.shields.io/badge/Documentation-blue.svg?style=for-the-badge">
38+
</a>
39+
<a aria-label="Community on Sixfab.com" href="https://community.sixfab.com/" target="_blank">
40+
<img alt="" src="https://img.shields.io/badge/Community-blue.svg?style=for-the-badge">
41+
</a>
42+
</p>
43+
44+
## Configuration Files
45+
You can use a configuration file to increase maintainability of your embedded code. This file is named as `config.json` and stores necessary connection parameters which are designed for you to easily connect to the applications. You can find example files for each application and module in [CONFIGURATIONS.md](./CONFIGURATIONS.md) page.
46+
47+
This file has to be in the root directory of the PicoLTE device's file system.
48+
49+
## Contributing
50+
All contributions are welcome. You can find the guidelines in [CONTRIBUTING.md](./CONTRIBUTING.md).
51+
52+
## License
53+
Licensed under the [MIT license](https://choosealicense.com/licenses/mit/).

0 commit comments

Comments
 (0)