3 /// bplaybook command line tool
7 Copyright (C) 2011, Nicolas VIVIEN
8 Copyright (C) 2005-2011, Net Direct Inc. (http://www.netdirect.ca/)
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 See the GNU General Public License in the COPYING file at the
20 root directory of this project for more details.
24 #include <barry/barry.h>
30 #include "barrygetopt.h"
33 using namespace Barry
;
38 int logical
, major
, minor
;
39 const char *Version
= Barry::Version(logical
, major
, minor
);
42 << "bplaybook - Command line USB Blackberry PlayBook\n"
43 << " Copyright 2011, Nicolas VIVIEN.\n"
44 << " Using: " << Version
<< "\n"
47 << " -v Dump protocol data during operation\n"
53 int main(int argc
, char *argv
[], char *envp
[])
58 bool data_dump
= false;
59 vector
<string
> params
;
62 // process command line options
64 int cmd
= getopt(argc
, argv
, "hv");
70 case 'v': // data dump on
85 cerr
<< "unknown arguments" << endl
;
90 // Initialize the barry library. Must be called before
92 Barry::Init(data_dump
);
94 // Probe the USB bus for Blackberry devices and display.
95 // If user has specified a PIN, search for it in the
96 // available device list here as well
97 Barry::ProbePlayBook probe
;
99 catch( Usb::Error
&ue
) {
100 std::cout
<< endl
; // flush any normal output first
101 std::cerr
<< "Usb::Error caught: " << ue
.what() << endl
;
104 catch( Barry::Error
&se
) {
106 std::cerr
<< "Barry::Error caught: " << se
.what() << endl
;
109 catch( std::exception
&e
) {
111 std::cerr
<< "std::exception caught: " << e
.what() << endl
;