~vibhavp/ubuntu/saucy/urg/merge-from-debian

« back to all changes in this revision

Viewing changes to samples/cpp/versionLines.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Albert Huang
  • Date: 2011-05-20 11:33:03 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110520113303-u8niofzwzcea0osk
Tags: 0.8.12-1
* New upstream release (closes: #624987)
* Add debian/watch file
* Bump standards-version to 3.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*!
 
2
  \example versionLines.cpp
 
3
 
 
4
  \brief Displays VV command data
 
5
 
 
6
  \author Satofumi KAMIMURA
 
7
 
 
8
  $Id: versionLines.cpp 1737 2010-03-06 07:15:19Z satofumi $
 
9
*/
 
10
 
 
11
#include "UrgDevice.h"
 
12
#include <iostream>
 
13
#include <cstdlib>
 
14
#include <cstdio>
 
15
 
 
16
using namespace qrk;
 
17
using namespace std;
 
18
 
 
19
 
 
20
//! main
 
21
int main(int argc, char *argv[])
 
22
{
 
23
#ifdef WINDOWS_OS
 
24
  const char device[] = "COM3";
 
25
#else
 
26
  const char device[] = "/dev/ttyACM0";
 
27
#endif
 
28
 
 
29
  UrgDevice urg;
 
30
  if (! urg.connect(device)) {
 
31
    printf("UrgDevice::connect: %s\n", urg.what());
 
32
    exit(1);
 
33
  }
 
34
 
 
35
  vector<string> lines;
 
36
 
 
37
  // Receive version information
 
38
  urg.versionLines(lines);
 
39
  if (lines.empty()) {
 
40
    cerr << "UrgDevice::versionLines: " << urg.what() << endl;
 
41
    exit(1);
 
42
  }
 
43
 
 
44
  // Display
 
45
  for (vector<string>::iterator it = lines.begin();
 
46
       it != lines.end(); ++it) {
 
47
    cout << *it << endl;
 
48
  }
 
49
 
 
50
#ifdef MSC
 
51
  getchar();
 
52
#endif
 
53
 
 
54
  return 0;
 
55
}