-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,532 additions
and
628 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
\lipsum[1] | ||
The Internet of Things is very relevant in today's society, as it allows the creation of systems to collect and process data, as well as to transmit commands to different devices. However, the implementation of these systems presents problems in certain environments due to various difficulties and costs. These difficulties may arise from the impossibility of installing an Internet network, the high power consumption of the devices or the need to use a wireless network without an adequate infrastructure to process and transmit messages. | ||
To solve this problem, the LoboMQ protocol is proposed, which allows to manage messages transmitted between several low-power microcontrollers using message queues inspired by the MQTT publish-subscribe pattern, and takes advantage of ESP-NOW to perform the transmissions without the need of an Internet network. The aim of the protocol development and its implementation in a C++ library is to offer a simple-to-use solution to the Internet of Things community. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
\lipsum[2] | ||
Agradezco a todo aquel que me ha acompañado durante este camino con baches y flores que ha sido el grado, a mis amigos, a mi pareja con quien he podido compartir cientos de momentos y depositar total confianza, y a mi familia, como a mi padre y a mi abuela, que pese a no entender ni un pijo de lo que hago, están ahí y me preguntan de vez en cuando que de qué va lo que estudio. | ||
|
||
Quiero también agradecer a todos los profesores con los que me he cruzado durante esta formación académica. En especial, a mis tutores Rubén y Ana, por ayudarme y apoyarme en esta última etapa, por haber sido demasiado pacientes conmigo y por haber confiado en mí hasta el último momento (o eso quiero pensar). | ||
|
||
Por último y no menos importante, estoy agradecido con mi yo del pasado, por todo el esfuerzo que ha hecho y todas esas malas decisiones que han hecho llegar a un ámbito en el que me considero cómodo, y con mi yo del futuro, que espero que eche la vista hacia atrás y diga "las noches en vela merecieron la pena". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Pruebas | ||
|
||
Se han desarrollado pruebas para comprobar la correcta ejecución del código en la librería. Debido a que PlatformIO no proporciona una manera sencilla de verificar la correcta comunicación entre dos placas, en este capítulo solo se abordan pruebas que evalúan funciones de la librería que no están relacionadas directamente con el envío de datos. | ||
|
||
En el caso de los ficheros `PubSub`, estas pruebas unitarias de caja negra tienen como objetivo probar la correcta identificación de los mensajes y los temas restringidos para publicar o suscribirse. | ||
|
||
La primera prueba consiste en crear un mensaje con un número y almacenarlo como bytes, tal como lo haría un publicador. Luego, se llama a la función `isLMQMessage()` para comprobar que se trata de un mensaje compatible con LoboMQ, y posteriormente se extraen los datos creando los correspondientes objetos, llamando a la función `getLMQPayload()` para obtener el contenido de los bytes, al igual que lo haría un suscriptor. Finalmente, se verifica si el número empaquetado sigue siendo el mismo. Este código se detalla en el Listado \ref{anexoPruebas:testCreateGetMessage} | ||
|
||
```{.cpp #anexoPruebas:testCreateGetMessage .numberLines caption="Código para probar la creación de mensajes y la obtención de su contenido" frame=single} | ||
//Payload structure | ||
typedef struct { | ||
int number; | ||
} CustomPayloadStruct; | ||
|
||
TEST_CASE("Create Message And Check And Get Content") { | ||
int number = 666; | ||
|
||
//Create and fill publish message | ||
CustomPayloadStruct payloadSend; | ||
payloadSend.number = number; | ||
PublishContent pubMsg; | ||
pubMsg.type = MSGTYPE_PUBLISH; | ||
strcpy(pubMsg.topic, "test"); | ||
pubMsg.contentSize = sizeof(payloadSend); | ||
memcpy(&pubMsg.content, &payloadSend, sizeof(payloadSend)); | ||
|
||
//Transform to bytes | ||
const uint8_t *data = (const uint8_t *) &pubMsg; | ||
|
||
CHECK(isLMQMessage(data) == true); | ||
|
||
//Extract payload from bytes | ||
PayloadContent contentRecv = getLMQPayload(data); | ||
CustomPayloadStruct payloadRecv; | ||
memcpy(&payloadRecv, &contentRecv.content, contentRecv.contentSize); | ||
|
||
CHECK(payloadRecv.number == number); | ||
} | ||
``` | ||
El resto de los tests de estos ficheros prueban la compatibilidad de los temas con la publicación y la suscripción. A partir de las verificaciones que se realizan al publicar o suscribirse, se han identificado una serie de casos de prueba, mostrados en la Tabla \ref{anexoPruebas:casosTopics} junto al parámetro que recibe la función y el resultado esperado. Estos buscan cubrir todas las condiciones y decisiones posibles. Se prueba la comprobación de temas nulos o vacíos, la presencia de caracteres ASCII, el tamaño excesivo de los temas y el uso de caracteres comodín en posiciones prohibidas. | ||
| Función | Parámetros | Resultado | | ||
| --------------- | -------------------------------------- | --------------------- | | ||
| `pubTopicCheck` | `topic = "/aaa/"` | `LMQ_ERR_SUCCESS` | | ||
| `pubTopicCheck` | `topic = "aaa"` | `LMQ_ERR_SUCCESS` | | ||
| `pubTopicCheck` | `topic = "aaa/+` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = "aaa/+/aaa"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = "+/aaa"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = "+"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = "aaa/#"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = "aaa/#/aaa"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = "#/aaa"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = "#"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = "/"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = ""` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = null` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = "ááá"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `pubTopicCheck` | `topic = "aaaaaaaaaaaaaaaaaaaaaaaaaa"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| --------------- | -------------------------------------- | --------------------- | | ||
| `subTopicCheck` | `topic = "/aaa/"` | `LMQ_ERR_SUCCESS` | | ||
| `subTopicCheck` | `topic = "aaa"` | `LMQ_ERR_SUCCESS` | | ||
| `subTopicCheck` | `topic = "aaa/+` | `LMQ_ERR_SUCCESS` | | ||
| `subTopicCheck` | `topic = "aaa/+/aaa"` | `LMQ_ERR_SUCCESS` | | ||
| `subTopicCheck` | `topic = "+/aaa"` | `LMQ_ERR_SUCCESS` | | ||
| `subTopicCheck` | `topic = "+"` | `LMQ_ERR_SUCCESS` | | ||
| `subTopicCheck` | `topic = "aaa/#"` | `LMQ_ERR_SUCCESS` | | ||
| `subTopicCheck` | `topic = "aaa/#/aaa"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `subTopicCheck` | `topic = "#/aaa"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `subTopicCheck` | `topic = "#"` | `LMQ_ERR_SUCCESS` | | ||
| `subTopicCheck` | `topic = "/"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `subTopicCheck` | `topic = ""` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `subTopicCheck` | `topic = null` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `subTopicCheck` | `topic = "ááá"` | `LMQ_ERR_INVAL_TOPIC` | | ||
| `subTopicCheck` | `topic = "aaaaaaaaaaaaaaaaaaaaaaaaaa"` | `LMQ_ERR_INVAL_TOPIC` | | ||
: Casos de prueba en la comprobación de topics\label{anexoPruebas:casosTopics} | ||
Estas pruebas se encuentran en la carpeta `test` de la librería. Han sido desarrolladas con el framework de pruebas Doctest[^anexoPruebas:doctest], y para su ejecución se requiere de placas compatibles con el modo de depuración y pruebas, conectadas al ordenador encargado de compilar y subir el código del test desde PlatformIO. | ||
[^anexoPruebas:doctest]: <https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/doctest.html> |
5 changes: 5 additions & 0 deletions
5
tfg_report/templateAPP/input/appendices/02_diagrama_clases.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Diagrama de clases | ||
|
||
![Diagrama de clases de LoboMQ[^anexoDiagramaClases:enlace]\label{anexoDiagramaClases:clases}](clases.png){width=69%} | ||
|
||
[^anexoDiagramaClases:enlace]: Disponible con mayor resolución en <https://github.com/rubnium/LoboMQ/blob/master/tfg_report/resource_scr/clases_horiz.png> |
Oops, something went wrong.