Skip to content

Instantly share code, notes, and snippets.

@gustavolaureano
Created August 16, 2018 13:05
Show Gist options
  • Save gustavolaureano/77251521510e61e9a3206f7203a645f8 to your computer and use it in GitHub Desktop.
Save gustavolaureano/77251521510e61e9a3206f7203a645f8 to your computer and use it in GitHub Desktop.
#include <MQTTZephyr.h>
void TimerCountdownMS(Timer* timer, unsigned int timeout_ms)
{
timer->end_time = k_uptime_get() + timeout_ms;
}
void TimerCountdown(Timer* timer, unsigned int timeout)
{
TimerCountdownMS(timer, timeout * 1000);
}
int TimerLeftMS(Timer* timer)
{
int left = timer->end_time - k_uptime_get();
return (left < 0) ? 0 : left;
}
char TimerIsExpired(Timer* timer)
{
int left = timer->end_time - k_uptime_get();
return (left < 0);
}
void TimerInit(Timer* timer)
{
timer->end_time = 0;
}
int Zephyr_AT_read(Network* n, unsigned char* buffer, int len, int timeout_ms)
{
}
int Zephyr_AT_write(Network* n, unsigned char* buffer, int len, int timeout_ms)
{
}
void Zephyr_AT_disconnect(Network* n)
{
}
void NetworkInit(Network* n)
{
n->my_socket = 0;
n->mqttread = Zephyr_AT_read;
n->mqttwrite = Zephyr_AT_write;
n->disconnect = Zephyr_AT_disconnect;
}
int NetworkConnect(Network* n, char* addr, int port)
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment