Skip to content

Commit

Permalink
Create gateway_firmware.bin
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 5, 2024
1 parent a4544be commit f07d550
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions iot/devices/gateway/firmware/gateway_firmware.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <zephyr/types.h>
#include <zephyr/kernel.h>
#include <zephyr/net/mqtt.h>
#include <zephyr/net/coap.h>

#define MQTT_BROKER_ADDRESS "mqtt://localhost:1883"
#define COAP_SERVER_ADDRESS "coap://localhost:5683"

int main(void)
{
// Initialize MQTT client
mqtt_client_t client;
mqtt_client_init(&client, MQTT_BROKER_ADDRESS);

// Initialize CoAP server
coap_server_t server;
coap_server_init(&server, COAP_SERVER_ADDRESS);

// Start MQTT client
mqtt_client_start(&client);

// Start CoAP server
coap_server_start(&server);

while (1) {
// Handle MQTT messages
mqtt_client_handle_message(&client);

// Handle CoAP requests
coap_server_handle_request(&server);
}

return 0;
}

0 comments on commit f07d550

Please sign in to comment.