Change peripheral io UART APIs 55/151955/2 accepted/tizen/unified/20170926.165625 submit/tizen/20170926.023501
authorkibak.yoon <kibak.yoon@samsung.com>
Fri, 22 Sep 2017 11:41:53 +0000 (20:41 +0900)
committerchanywa <cbible.kim@samsung.com>
Tue, 26 Sep 2017 03:39:22 +0000 (12:39 +0900)
Change-Id: Ic5c5c26c88720c270188cfde10d777ad66297e32
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
gps-plugin/src/gps_plugin_replay.c

index 86be4c0..1ee1487 100644 (file)
@@ -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;