Merge branch 'linux-port' into jna-port
This commit is contained in:
commit
24745f476a
|
@ -107,7 +107,7 @@ void *eventloop(void *arg) {
|
||||||
// Or read a byte send by somebody else.
|
// Or read a byte send by somebody else.
|
||||||
res = read(serial_fd, &uart_rx_byte, 1);
|
res = read(serial_fd, &uart_rx_byte, 1);
|
||||||
if(res == 1) {
|
if(res == 1) {
|
||||||
printf("Read %x\n", uart_tx_byte);
|
printf("Read %x\n", uart_rx_byte);
|
||||||
// Lock mutexes and call rx handler
|
// Lock mutexes and call rx handler
|
||||||
pthread_mutex_lock(&state_mutex);
|
pthread_mutex_lock(&state_mutex);
|
||||||
pthread_mutex_lock(&rx_buffer_mutex);
|
pthread_mutex_lock(&rx_buffer_mutex);
|
||||||
|
|
|
@ -11,28 +11,31 @@ int main(int argc, char const *argv[]) {
|
||||||
uint8_t msg[LIBSSS7_PAYLOAD_SIZE];
|
uint8_t msg[LIBSSS7_PAYLOAD_SIZE];
|
||||||
memset(msg, 0, LIBSSS7_PAYLOAD_SIZE);
|
memset(msg, 0, LIBSSS7_PAYLOAD_SIZE);
|
||||||
msg[0] = 'H';
|
msg[0] = 'H';
|
||||||
msg[1] = 'e';
|
msg[1] = 'a';
|
||||||
msg[2] = 'l';
|
msg[2] = 'l';
|
||||||
msg[3] = 'l';
|
msg[3] = 'l';
|
||||||
msg[4] = 'o';
|
msg[4] = 'o';
|
||||||
msg[5] = ' ';
|
msg[5] = ' ';
|
||||||
msg[6] = 'W';
|
msg[6] = 'W';
|
||||||
msg[7] = 'o';
|
msg[7] = 'e';
|
||||||
msg[8] = 'r';
|
msg[8] = 'l';
|
||||||
msg[9] = 'l';
|
msg[9] = 't';
|
||||||
msg[10] = 'd';
|
|
||||||
|
|
||||||
|
|
||||||
//while(1) {
|
while(!libsss7_can_send());
|
||||||
|
libsss7_send(msg);
|
||||||
|
while(!libsss7_can_send());
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
while(!libsss7_can_send());
|
|
||||||
libsss7_send(msg);
|
|
||||||
while(!libsss7_can_send());
|
|
||||||
if(libsss7_send_failed()) {
|
|
||||||
printf("Send failed\n");
|
|
||||||
}
|
|
||||||
sleep(5);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
libsss7_send(msg);
|
libsss7_send(msg);
|
||||||
|
|
Loading…
Reference in New Issue