Created
October 30, 2014 18:17
-
-
Save patrickt/0ce2e13d927208ef496d to your computer and use it in GitHub Desktop.
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
#include <stdio.h> | |
#include <helium.h> | |
#include <stdint.h> | |
#include <inttypes.h> | |
#include <unistd.h> | |
void my_callback(const helium_connection_t *conn, uint64_t mac, char * const message, size_t count) | |
{ | |
printf("Connection %p received message '%s' from device %" PRIx64 ".\n", (void *)conn, message, mac); | |
} | |
int main(int argc, char *argv[]) | |
{ | |
helium_connection_t *conn = helium_alloc(); | |
helium_open(conn, "r01.sjc.helium.io", my_callback); | |
char *base64 = "kdTl6U1w+sR61NBiQjm8sw=="; | |
helium_token_t token; | |
helium_base64_token_decode((unsigned char *)base64, strlen(base64), token); | |
helium_subscribe(conn, 0x000000fffff00001, token); | |
const char *text = "If you don't know, now you know."; | |
helium_send(conn, 0x000000fffff00001, token, (unsigned char *)text, strlen(text)); | |
sleep(10); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment