# m_mode_base.h

Go to the documentation of this file.

    00001 ///
    00002 /// \file       m_mode_base.h
    00003 ///             Base for mode classes
    00004 ///
    00005
    00006 /*
    00007     Copyright (C) 2005-2011, Net Direct Inc. (http://www.netdirect.ca/)
    00008
    00009     This program is free software; you can redistribute it and/or modify
    00010     it under the terms of the GNU General Public License as published by
    00011     the Free Software Foundation; either version 2 of the License, or
    00012     (at your option) any later version.
    00013
    00014     This program is distributed in the hope that it will be useful,
    00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00017
    00018     See the GNU General Public License in the COPYING file at the
    00019     root directory of this project for more details.
    00020 */
    00021
    00022 #ifndef __BARRY_M_MODE_BASE_H__
    00023 #define __BARRY_M_MODE_BASE_H__
    00024
    00025 #include "dll.h"
    00026 #include "controller.h"
    00027
    00028 namespace Barry {
    00029
    00030 namespace Mode {
    00031
    00032 //
    00033 // Mode class
    00034 //
    00035 /// Base class for simple mode classes.  Put common code here.
    00036 ///
    00037 class BXEXPORT Mode
    00038 {
    00039 protected:
    00040         Controller &m_con;
    00041         Controller::ModeType m_modetype;
    00042         SocketHandle m_socket;
    00043
    00044         uint16_t m_ModeSocket;                  // socket recommended by device
    00045                                                 // when mode was selected
    00046
    00047 public:
    00048         Mode(Controller &con, Controller::ModeType type);
    00049         virtual ~Mode();
    00050
    00051         //////////////////////////////////
    00052         // primary operations - required before anything else
    00053
    00054         void Open(const char *password = 0);
    00055         void Open(const char *password, const char *name);
    00056         void RetryPassword(const char *password);
    00057 //      void Close();
    00058
    00059 protected:
    00060         //////////////////////////////////
    00061         // overrides
    00062
    00063         virtual void OnOpen();
    00064 };
    00065
    00066 }} // namespace Barry::Mode
    00067
    00068 #endif
    00069