00001 /*************************************************************************** 00002 l1394_avcregister.h - description 00003 ------------------- 00004 begin : Fri Nov 3 2000 00005 copyright : (C) 2000-2004 by Michael Repplinger 00006 email : repplinger@cs.uni-sb.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef L1394AVCREGISTER_H 00019 #define L1394AVCREGISTER_H 00020 00021 #include "l1394_qarray.h" 00022 #include "l1394_resource.h" 00023 #include "l1394_deviceregister.h" 00024 00025 00026 00027 namespace L1394{ 00028 /*! \class AvcRegister 00029 * \ingroup L1394_Register 00030 * \brief This class implements the DeviceRegister interface for devices 00031 * based on the AV/C specification. 00032 * 00033 * @author Michael Repplinger 00034 */ 00035 class FcpNode; 00036 class AvcRegister : public DeviceRegister 00037 { 00038 public: 00039 /*! \name AvcRegister constructor 00040 * These functions implement the Register objects for AV/C devices. 00041 */ 00042 //@{ 00043 00044 /*! \fn AvcRegister(const FcpNode* parent_node, const int subunit_value) 00045 * \brief This method creates a Register object for AV/C devices. 00046 * \param FcpNode* : pointer to the parent node. 00047 * \param subunit_value : The subunit value defines the subunit-type and the subunit-id of the device. 00048 */ 00049 AvcRegister(const FcpNode* parent_node, const int subunit_value); 00050 00051 00052 /*! \fn ~AvcRegister() 00053 * \brief destructor 00054 */ 00055 virtual ~AvcRegister(); 00056 //@} 00057 /*! \name Register interface for A/VC devices 00058 * These functiosn implement the minimal DeviceRegister interface for A/VC devices 00059 */ 00060 //@{ 00061 /*! \fn send() const 00062 * \brief This method sends the command and returns the response code. 00063 * 00064 * After sending, the internal data Array will be restored and set to size 1. 00065 * \return QArray : returns the response code. 00066 */ 00067 int send() const ; 00068 00069 /*! \fn hasFeature() const 00070 * \brief This method tests, if a command is supported by a node. 00071 * 00072 * For this method the general inquiry command is used. 00073 * \return bool : returns true, if a node reports an IMPLEMENTED for this feature, false if not. 00074 */ 00075 bool hasFeature() const ; 00076 00077 00078 /*! \fn hasFeature(const int command) const 00079 * \brief This method tests, if a submethod of a command is supported by the device. 00080 * 00081 * \param command : value for the subcommand (see the specific AV/C 00082 * subunit specification for more information) 00083 * \return bool : return true, if node report an IMPLEMENTED for this feature, false if not. 00084 */ 00085 bool hasFeature(const int command) const ; 00086 00087 00088 /*! \fn status() const 00089 * \brief This method returns the status of subfunction(0xFF normally for the feature itself) 00090 * 00091 * \return QArray : QArray with the response code. 00092 */ 00093 QArray status() const; 00094 //@} 00095 00096 00097 /*! \name Some internal methods 00098 * These methods help to implement the interface. 00099 */ 00100 //@{ 00101 /*! \fn setCtype(const int ctype) 00102 * \brief This method sets the command type. 00103 * \param ctype : new command-type. 00104 * \return AvcRegister* : returns a pointer to this object. 00105 */ 00106 AvcRegister* setCtype(const int ctype) { data_array->setByte(0,ctype); return this;} 00107 00108 /*! \fn setSubfunction(const int subfunction) 00109 * \brief This method sets the subfunction. 00110 * \param subfunction : new subfunction value. 00111 * \return AvcRegister* : returns a pointer to this object. 00112 */ 00113 AvcRegister* setSubfunction(const int subfunction) { data_array->setByte(3,subfunction); return this;} 00114 00115 /*! \fn setOpcode(const int opcode) 00116 * \brief This method sets the opcode. 00117 * \param opcode : new operation code. 00118 * \return AvcRegister* : returns a pointer to this object. 00119 */ 00120 AvcRegister* setOpcode(const int opcode) { data_array->setByte(2,opcode); return this;} 00121 00122 /*! \fn defaultSet(const int length,const int opcode,const int value) 00123 * \brief This method sets default value for the array. FOR INTERNAL USE ONLY!! 00124 */ 00125 AvcRegister* defaultSet(const int length,const int opcode,const int value); 00126 00127 /*! \fn getData() 00128 * \brief return the data_array. FOR INTERNAL USE ONLY!!! 00129 */ 00130 QArray* getData() {return data_array;} 00131 //@} 00132 protected: 00133 00134 //! This method resets the data_arry 00135 AvcRegister* reset(const int size); 00136 00137 //! pointer to the parent node 00138 const FcpNode* parent_node; 00139 00140 //! the data_array 00141 QArray* data_array; 00142 00143 //! actual op_code 00144 int opcode; 00145 00146 //! actual subunit_value 00147 int subunit_value; 00148 00149 //! actual command type 00150 int ctype; 00151 00152 //! actual subfunction 00153 int subfunction; 00154 //! variable to test if the data_array was reset. 00155 bool restore; 00156 00157 }; 00158 } 00159 #endif