Applied bjavaloader patch from Nicolas Vivien
[barry.git] / src / m_javaloader.h
blob64d274f48eacf92186e8e9733d90b7e50c4f1139
1 ///
2 /// \file m_javaloader.h
3 /// Mode class for the JavaLoader mode
4 ///
6 /*
7 Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/)
8 Copyright (C) 2008-2009, Nicolas VIVIEN
10 Some parts are inspired from m_desktop.h
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU General Public License in the COPYING file at the
22 root directory of this project for more details.
25 #ifndef __BARRY_M_JAVALOADER_H__
26 #define __BARRY_M_JAVALOADER_H__
28 #include "dll.h"
29 #include "socket.h"
30 #include "record.h"
32 namespace Barry {
34 // forward declarations
35 class Parser;
36 class Builder;
37 class Controller;
39 namespace Mode {
42 // Desktop class
44 /// The main interface class to the device databases.
45 ///
46 /// To use this class, use the following steps:
47 ///
48 /// - Create a Controller object (see Controller class for more details)
49 /// - Create this Mode::JavaLoader object, passing in the Controller
50 /// object during construction
51 /// - Call Open() to open database socket and finish constructing.
52 /// - Call LoadDatabase() to retrieve and store a database
53 ///
54 class BXEXPORT JavaLoader
56 public:
57 enum CommandType { Unknown, DatabaseAccess };
59 private:
60 Controller &m_con;
62 SocketHandle m_socket;
64 CommandTable m_commandTable;
66 uint16_t m_ModeSocket; // socket recommended by device
67 // when mode was selected
69 protected:
71 public:
72 JavaLoader(Controller &con);
73 ~JavaLoader();
75 //////////////////////////////////
76 // primary operations - required before anything else
78 void Open(const char *password = 0);
79 void RetryPassword(const char *password);
81 //////////////////////////////////
82 // API
83 void StartStream();
84 void SendStream(char *buffer, int size);
85 void StopStream(void);
88 }} // namespace Barry::Mode
90 #endif