2
\example scip_20_pp.cpp
4
\brief Get PP command response
6
\author Satofumi KAMIMURA
8
$Id: scip_20_pp.cpp 1701 2010-02-16 05:33:25Z satofumi $
11
#include "SerialDevice.h"
13
#include "ConnectionUtils.h"
21
int main(int argc, char *argv[])
23
// Change the port name appropriately
24
#if defined(WINDOWS_OS)
25
const char device[] = "COM3";
26
#elif defined(LINUX_OS)
27
const char device[] = "/dev/ttyACM0";
29
const char device[] = "/dev/tty.usbmodem1d11";
33
if (! con.connect(device, 19200)) {
34
printf("SerialDevice::connect: %s\n", con.what());
35
#if defined(WINDOWS_OS)
36
printf("Hit return key.\n");
42
// Call Scip2.0 and neglect the response.
43
enum { Timeout = 200 };
44
con.send("SCIP2.0\n", 8);
50
// Display received data
51
enum { LineMax = 64 + 1 };
54
while ((n = readline(&con, buffer, LineMax, Timeout)) > 0) {
55
printf("%s\n", buffer);
58
#if defined(WINDOWS_OS)
59
printf("Hit return key.\n");