Skip to content

Commit

Permalink
Merge branch 'dev' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiotomasello committed Apr 6, 2021
2 parents 6737fc4 + 4b8944b commit 0c44c72
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 138 deletions.
7 changes: 5 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ package_release:
#- DATE="$(cat tmp/date.tmp)"
# packaging for PlatformIO
- jq --arg tag_ver ${CI_COMMIT_TAG} '.version = $tag_ver' library.json|sponge library.json
# - pio package pack -o /tmp
- pio package pack -o /tmp
# standard packaging as ZIP archive
- sed -i "s/version=.*/version=${CI_COMMIT_TAG}/g" library.properties
- PKG_NAME=$CI_PROJECT_NAME-$CI_COMMIT_TAG
Expand Down Expand Up @@ -173,7 +173,10 @@ upload:
# Upload to Artifactory
- curl -u $REPO_USR:$REPO_PWD -T tmp/$PKG_NAME.zip "${REPO_BASE_URL}/artifactory/${REPO_NAME}/${TARGET_PATH}/${PKG_NAME}.zip"
# publishing to PlatformIO
# - pio package publish --owner smartme-io /tmp/Arancino-${CI_COMMIT_TAG}.tar.gz
- >
if [[ ${PRE_RELEASE} == "" ]]; then
pio package publish --owner smartme-io /tmp/Arancino-${CI_COMMIT_TAG}.tar.gz
fi
#################################
####### CLEANUP #######
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

#### v 1.4.1 - 2021.04.06
* Fix: Fixed bug with `println` function. [#gk5z1y](https://app.clickup.com/t/gk5z1y)
* Fix: Fixed bug with float's and double's types in `set` function. [#g71qk9](https://app.clickup.com/t/g71qk9)

#### v 1.4.0 - 2021.03.15
* Upd: Metadata structure is now mandatory to the `begin` function. [#aex3e4](https://app.clickup.com/t/aex3e4)
* Add: New `ArancinoConfig` Class used to pass configuration at `begin`. [#fd4ped](https://app.clickup.com/t/fd4ped)
Expand Down
85 changes: 46 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,25 @@ typedef struct {
### ArancinoConfig
`ArancinoConfig` is class composed only by attributes used to configure the Arancino Library behaviour. It replaces the use of direct configuration arguments of the `begin` function.
```c++
bool _USEID = false;
int _TIMEOUT = TIMEOUT; // 100 ms for samd21
int _TIMEOUT = 100 ; // *DEPRECATED* Use SERIAL_TIMEOUT
bool _USEID; // *DEPRECATED* Use USE_PORT_ID_PREFIX_KEY
int DECIMAL_DIGITS = 4;
int SERIAL_TIMEOUT = 100;
bool USE_PORT_ID_PREFIX_KEY = false;

```

- **`SERIAL_TIMEOUT`**: Represents the time that each command sent (via API call) will wait
for a response. Otherwise the delayed command will be skipped. When the
`begin` function is called w/o `timeout` it is assumed `100ms` as
default value of timeout.
- **`USE_PORT_ID_PREFIX_KEY`**: Default `false`. If `true` each key setted up is prefixed with ID of the microntroller.
It's useful when you connect multiple microntroller with the same firmware (using the same keys) to
one Arancino Module; By this way, at the application level, you can distinguish keys by
microntroller id.
- **`DECIMAL_DIGITS`**: Default `4`. Represents the number to the right of the decimal point for the float and double data types.
Float data type has 7 digits, while double data type has up to 15 digits, including decimal digits.
If the digits exceed the maximum allowed for the type(float or double), the decimal part will be truncated and rounded up or rounded down.

##### Variables
* `isError`: indicates the outcome of an API call. Its value is `False` (0) when everything is OK or `True` (1) when an error occurs. Both in positive and negative cases is possible to check `responseCode` for more details;
Expand Down Expand Up @@ -101,7 +116,7 @@ typedef struct {
## API


> Note: when you get a value using api like `get`, `hget`, etc. please keep in mind to free memory each time using the `free` api.
> Note: when you get a value using api like `get`, `hget`, etc. please keep in mind to free memory each time using the `free` api.
>
> To prevent memory leak, code like this must be avoided:
> ```c++
Expand Down Expand Up @@ -132,15 +147,15 @@ Stores the metadata to use later during the `START` command in `begin` API.
ArancinoMetadata amdata = {
.fwname = "Arancino Firmware",
.fwversion = "1.0.0",
.tzoffset = "+1000"
.tzoffset = "+1000"
};
void setup() {
// deprecated: do not use the .metadata function directly. Use the mandatory metadata argument in the begin function instead.
// This will be removed in the next major relase
//Arancino.metadata(meta);
//
Arancino.begin(amdata);
}
Expand All @@ -160,23 +175,15 @@ From version `1.4.0` the `ArancinoMetadata` argument became mandatory, becouse t
From version
##### Parameters
- ArancinoConfig: is class composed only by attributes:
- `_TIMEOUT`: (see the following paragraph: `timeout`)
- `_USEID`: (see the following paragraph: `useid`)
The convenience of using class X is to be able to increase the number of parameters without necessarily having to change the prototypes.
The use of the following is deprecated and will be remove in the next major release.
- **`timeout`**: Represents the time that each command sent (via API call) will wait
for a response. Otherwise the delayed command will be skipped. When the
`begin` function is called w/o `timeout` it is assumed `100ms` as
default value of timeout.
- **`useid`**: Default `false`. If `true` each key setted up is prefixed with ID of the microntroller.
It's useful when you connect multiple microntroller with the same firmware (using the same keys) to
one Arancino Module; By this way, at the application level, you can distinguish keys by
microntroller id.
- ArancinoConfig: is class composed only by attributes (see the following paragraph: [`Arancino Config`](#ArancinoConfig)):
- `DECIMAL_DIGITS`
- `SERIAL_TIMEOUT`
- `PORT_ID_PREFIX_KEY`
The convenience of using class ArancinoConfig is to be able to increase the number of parameters without necessarily having to change the prototypes.
The use of the following arguments in the `begin` function is deprecated and will be removed in the next major release.
- **`timeout`**
- **`useid`**
___
### set
Expand All @@ -201,8 +208,8 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `response`: `NULL`;
###### Note: [2](###notes)
###### Note: [5](###notes)
###### Note: [2](#notes), [5](#notes)
___
### get
##### *char* get(char* key)*
Expand All @@ -227,7 +234,7 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `response.string`: `char*` pointer that can contain the value of selected *key* or `NULL` if the *key* doesn't exist.
###### Note: [1](###notes), [4](###notes)
###### Note: [1](#notes), [4](#notes)
___
Expand All @@ -247,13 +254,13 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `responseType`: `VOID`;
* `response`: `NULL`;
###### Note: [3](###notes)
###### Note: [3](#notes)
### mget
##### *char** mget(char** keys, char** values, uint len)*
##### *ArancinoPacket mget\<ArancinoPacket>(char&ast;&ast; keys, uint len)*
Retrieves multiple keys from redis.
Retrieves multiple keys from redis.
##### Parameters
* **`keys`**: array containing keys to retrieve;
Expand All @@ -273,7 +280,7 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `response.stringarray`: `char**` pointer that points to the start of the returned array of strings.
###### Note: [1](###notes), [4](###notes)
###### Note: [1](#notes), [4](#notes)
### del
##### *int del(char&ast; key )*
Expand All @@ -296,7 +303,7 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `response.integer`: The number of keys that were removed.
###### Note: [1](###notes)
###### Note: [1](#notes)
___
### keys
Expand Down Expand Up @@ -352,7 +359,7 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `response`: `NULL`;
###### Note: [2](###notes)
###### Note: [2](#notes)
___
### hget
Expand All @@ -378,7 +385,7 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `response.string`: `char*` pointer that can contain the *value* if a value is stored in *field* at *key* or `NULL` if there isn't a value stored.
###### Note: [1](###notes), [4](###notes)
###### Note: [1](#notes), [4](#notes)
___
### hgetall
Expand All @@ -401,7 +408,7 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `responseType`: `STRING_ARRAY`;
* `response.stringArray`: `char**` pointer that can contain the string array of field and value matching *key*
###### Note: [1](###notes), [4](###notes)
###### Note: [1](#notes), [4](#notes)
___
### hkeys
Expand All @@ -425,7 +432,7 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `response.stringArray`: `char**` pointer to the string array of *fields* matching *key*.
###### Note: [1](###notes), [4](###notes)
###### Note: [1](#notes), [4](#notes)
___
### hvals
Expand All @@ -448,7 +455,7 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `response.stringArray`: `char**` pointer to the string array of *values* matching *key*.
###### Note: [1](###notes), [4](###notes)
###### Note: [1](#notes), [4](#notes)
___
### hdel
Expand All @@ -475,7 +482,7 @@ ArancinoPacket reply: [ArancinoPacket](#arancinopacket) containing:
* `response.integer`: 1 if the *field* is removed from hash or 0 if the *field* or the *key* does not exist in the hash.
###### Note: [1](###notes)
###### Note: [1](#notes)
___
### flush
Expand Down Expand Up @@ -638,9 +645,9 @@ void setup() {
void loop() {
char* str = "Test";
if(isValidUTF8(str))
if(isValidUTF8(str))
Arancino.set("key3", str);
}
```
### Notes
Expand All @@ -661,9 +668,9 @@ void loop() {
5. When using `set`-type functions, make sure that the value is correctly formatted with *utf-8* standard. Is recommended to use the internal function `isValidUTF8` before the `set` to avoid decoding errors on Arancino Module. Example:
```c++
char* value="test";
if(isValidUTF8(value))
if(isValidUTF8(value))
Arancino.set("key3", value);
```
## Cortex Protocol
Expand Down
12 changes: 6 additions & 6 deletions examples/Arancino/00-BEGIN/00-BEGIN.ino
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Parameters:
- _TIMEOUT: (see the following paragraph)
- _USEID: (see the following paragraph)
The convenience of using class X is to be able to increase the number of parameters
without necessarily having to change the prototypes.
The convenience of using class X is to be able to increase the number of parameters
without necessarily having to change the prototypes.
the use of the following is deprecated and will be remove in the next major release.
Expand All @@ -54,18 +54,18 @@ the use of the following is deprecated and will be remove in the next major rele
ArancinoMetadata amdata = {
.fwname = "00.1 - Begin Example",
.fwversion = "1.0.0",
.tzoffset = "+1000"
.tzoffset = "+1000"
};

void setup() {

// Arancino Configuration
ArancinoConfig acfg;
acfg._TIMEOUT = 200;

acfg.SERIAL_TIMEOUT = 200;
acfg.DECIMAL_DIGITS=4;

//calls begin w/o paramenter: it is assumed 100ms timeout by default
Arancino.begin(amdata);
Arancino.begin(amdata, acfg);

//calls begin w/ 200ms timeout trough Arancino Config
//Arancino.begin(amdata, acfg);
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/smartmeio/arancino-library.git"
},
"version": "1.4.0",
"version": "1.4.1",
"authors": {
"name": "smartme.IO",
"url": "https://www.arancino.cc"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Arancino
version=1.4.0
version=1.4.1
author=smartme.IO
maintainer=smartme.IO <[email protected]>
sentence=Enables communication between microcontroller and Arancino Module running mainly in Arancino boards.
Expand Down
Loading

0 comments on commit 0c44c72

Please sign in to comment.