From 08300eeabdf171950ea1cf96654104edc313c006 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Fri, 22 Sep 2017 20:41:53 +0900 Subject: [PATCH] Change peripheral io UART APIs Change-Id: Ic5c5c26c88720c270188cfde10d777ad66297e32 Signed-off-by: kibak.yoon --- gps-plugin/src/gps_plugin_replay.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/gps-plugin/src/gps_plugin_replay.c b/gps-plugin/src/gps_plugin_replay.c index 86be4c0..1ee1487 100644 --- a/gps-plugin/src/gps_plugin_replay.c +++ b/gps-plugin/src/gps_plugin_replay.c @@ -101,7 +101,7 @@ static int gps_uart_close() int ret; ret = peripheral_uart_close(uart_hndl); - if (ret < 0 ) { + if (ret < 0) { _E("GPS Uart Port Close failed !!"); return FALSE; } @@ -115,32 +115,36 @@ static int gps_uart_open() int ret; ret = peripheral_uart_open(GPS_UART_PORT, &uart_hndl); - if (ret < 0 ) { + if (ret < 0) { _E("GPS Uart Port Open failed !!"); return FALSE; } _D("GPS Uart Port Open Successful !!"); - ret = peripheral_uart_set_baudrate(uart_hndl, PERIPHERAL_UART_BAUDRATE_9600); + ret = peripheral_uart_set_baud_rate(uart_hndl, PERIPHERAL_UART_BAUD_RATE_9600); if (ret < 0) { _E("GPS Uart Port Open failed !!"); goto ERROR; } - ret = peripheral_uart_set_mode(uart_hndl, - PERIPHERAL_UART_BYTESIZE_8BIT, - PERIPHERAL_UART_PARITY_NONE, - PERIPHERAL_UART_STOPBITS_1BIT); + ret = peripheral_uart_set_byte_size(uart_hndl, PERIPHERAL_UART_BYTE_SIZE_8BIT); if (ret < 0) { _E("GPS Uart Set Mode failed !!"); goto ERROR; } - ret = peripheral_uart_set_flowcontrol(uart_hndl, true, false); + ret = peripheral_uart_set_parity(uart_hndl, PERIPHERAL_UART_PARITY_NONE); if (ret < 0) { - _E("GPS Uart Set Flow Control Open failed !!"); + _E("GPS Uart Set Mode failed !!"); + goto ERROR; + } + ret = peripheral_uart_set_stop_bits(uart_hndl, PERIPHERAL_UART_STOP_BITS_1BIT); + if (ret < 0) { + _E("GPS Uart Set Mode failed !!"); goto ERROR; } - ret = peripheral_uart_flush(uart_hndl); + ret = peripheral_uart_set_flow_control(uart_hndl, + PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS, + PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE); if (ret < 0) { - _E("GPS Uart Flush failed !!"); + _E("GPS Uart Set Flow Control Open failed !!"); goto ERROR; } return TRUE; @@ -446,7 +450,7 @@ gboolean gps_plugin_replay_read_nmea(replay_timeout *timer, char *nmea_data) break; } else { strncpy(nmea_data + strlen(nmea_data), buf, strlen(buf) - 1); - } + } } timer->nmea_data->len = strlen(buf); timer->nmea_data->data = buf; -- 2.7.4