FIXED - See REPLY
Based on information from http://forum.mangoh.io/t/sample-to-send-receive-serial-data-from-rs232-and-send-it-to-3g/285
- The .adef is modified to call out /dev/ttyHS0 as a required device
- at!mapuart? shows UART1 is in fact mapped as a Linux app device
- The base Legato is 17.11
- The code is based on the sample app httpGet, and the 3G works fine
- The callback handler is very much being called
but still no output to UART1 I can see. Note that ttyHSL0 becomes ttyHS0 if you map UART1 to be a Linux port.
See Reply Below.
static size_t PrintCallback
(
void *bufferPtr,
size_t size,
size_t nbMember,
void *userData // unused, but can be set with CURLOPT_WRITEDATA
)
{
int tty0;
int errcd;
//const char * mytxt =“TTYWRITE”;
tty0 = open("/dev/ttyHS0", O_RDWR | O_NOCTTY | O_NDELAY);
printf("Succesfully received data:\n");
printf("%d byte, nmembdat %d\n",size,nbMember);
printf ((char*)bufferPtr);
printf("==================================\n");
// fwrite(bufferPtr, size, nbMember, stdout);
fwrite(bufferPtr, size, nbMember, stdout);
errcd = write (tty0,“TTYWRITE\n”, 9);
if (errcd <0){
LE_ERROR(“port write error %d\n”,errcd);
}
close (tty0);
return size * nbMember;
}