2016-11-26 16:49:03 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
2016-11-30 22:47:26 +01:00
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
2016-11-26 16:49:03 +01:00
|
|
|
|
|
|
|
#include "libsss7.h"
|
|
|
|
|
|
|
|
int main(int argc, char const *argv[]) {
|
2016-11-30 22:47:26 +01:00
|
|
|
libsss7_start("/dev/ttyUSB0");
|
|
|
|
|
2016-12-03 22:58:55 +01:00
|
|
|
uint8_t msg[LIBSSS7_PAYLOAD_SIZE];
|
|
|
|
memset(msg, 0, LIBSSS7_PAYLOAD_SIZE);
|
2016-11-30 22:47:26 +01:00
|
|
|
msg[0] = 'H';
|
2016-12-04 20:51:19 +01:00
|
|
|
msg[1] = 'a';
|
2016-11-30 22:47:26 +01:00
|
|
|
msg[2] = 'l';
|
|
|
|
msg[3] = 'l';
|
|
|
|
msg[4] = 'o';
|
|
|
|
msg[5] = ' ';
|
|
|
|
msg[6] = 'W';
|
2016-12-04 20:51:19 +01:00
|
|
|
msg[7] = 'e';
|
|
|
|
msg[8] = 'l';
|
|
|
|
msg[9] = 't';
|
|
|
|
|
|
|
|
|
|
|
|
while(!libsss7_can_send());
|
|
|
|
libsss7_send(msg);
|
|
|
|
while(!libsss7_can_send());
|
2016-12-22 19:00:53 +01:00
|
|
|
printf("Send done\n");
|
2016-12-04 20:51:19 +01:00
|
|
|
if(libsss7_send_failed()) {
|
|
|
|
printf("Send failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
while(!libsss7_has_received());
|
|
|
|
uint8_t tmp[LIBSSS7_PAYLOAD_SIZE + 1];
|
|
|
|
memset(tmp, 0, LIBSSS7_PAYLOAD_SIZE + 1);
|
|
|
|
libsss7_get_received(tmp);
|
|
|
|
printf("Received: %s\n", tmp);
|
|
|
|
|
|
|
|
|
2016-11-30 22:47:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
libsss7_send(msg);
|
2016-11-26 16:49:03 +01:00
|
|
|
|
|
|
|
libsss7_stop();
|
|
|
|
return 0;
|
|
|
|
}
|