Fixes after merge
This commit is contained in:
parent
2def1aa693
commit
6c5ff15b5e
@ -3,6 +3,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@ -164,10 +165,13 @@ void disconnect(void* conn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Read/write/sleep platform functions
|
// Read/write platform functions
|
||||||
|
|
||||||
int32_t read_fd_linux(uint8_t* buf, uint16_t count, int32_t timeout_ms, void* arg) {
|
int32_t read_fd_linux(uint8_t* buf, uint16_t count, int32_t timeout_ms, void* arg) {
|
||||||
if(!arg) return -1;
|
if (!arg) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int fd = *(int*) arg;
|
int fd = *(int*) arg;
|
||||||
|
|
||||||
uint16_t total = 0;
|
uint16_t total = 0;
|
||||||
|
|||||||
@ -220,14 +220,12 @@ int main(int argc, char* argv[]) {
|
|||||||
if (conn) {
|
if (conn) {
|
||||||
// Set the next connection handler used by the read/write platform functions
|
// Set the next connection handler used by the read/write platform functions
|
||||||
nmbs_set_platform_arg(&nmbs, conn);
|
nmbs_set_platform_arg(&nmbs, conn);
|
||||||
}else{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = nmbs_server_poll(&nmbs);
|
err = nmbs_server_poll(&nmbs);
|
||||||
if (err != NMBS_ERROR_NONE) {
|
if (err != NMBS_ERROR_NONE) {
|
||||||
printf("Error on modbus connection - %s\n", nmbs_strerror(err));
|
printf("Error on modbus connection - %s\n", nmbs_strerror(err));
|
||||||
// In a more complete example, we would handle this error by checking its nmbs_error value
|
// In a more complete example, we would handle this error by checking its nmbs_error value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user