root/trunk/libfreebob/src/libfreebobavc/avc_generic.h

Revision 241, 4.2 kB (checked in by pieterpalmers, 18 years ago)

* configure.ac: Version bump to 1.0.0

* Changed all FreeBob? to FreeBoB
* Removed all .cvsignore
* Added Pieter to AUTHORS
* Updated NEWS and README (release canditate date added)

by Daniel Wagner

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* avc_generic.h
2  * Copyright (C) 2005 by Daniel Wagner
3  *
4  * This file is part of FreeBoB.
5  *
6  * FreeBoB is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * FreeBoB is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with FreeBoB; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA.
19  */
20
21 #ifndef AVCGeneric_h
22 #define AVCGeneric_h
23
24 #include "avc_definitions.h"
25
26 #include "../fbtypes.h"
27
28 #include <libavc1394/avc1394.h>
29
30 class IOSSerialize;
31 class IISDeserialize;
32 class Ieee1394Service;
33
34 const int fcpFrameMaxLength = 512;
35 typedef unsigned char fcp_frame_t[fcpFrameMaxLength];
36
37 class IBusData {
38 public:
39     IBusData() {}
40     virtual ~IBusData() {}
41
42     virtual bool serialize( IOSSerialize& se ) = 0;
43     virtual bool deserialize( IISDeserialize& de ) = 0;
44
45     virtual IBusData* clone() const = 0;
46 };
47
48 class AVCCommand
49 {
50 public:
51     enum EResponse {
52         eR_Unknown        = 0,
53         eR_NotImplemented = AVC1394_RESP_NOT_IMPLEMENTED,
54         eR_Accepted       = AVC1394_RESP_ACCEPTED,
55         eR_Rejected       = AVC1394_RESP_REJECTED,
56         eR_InTransition   = AVC1394_RESP_IN_TRANSITION,
57         eR_Implemented    = AVC1394_RESP_IMPLEMENTED,
58         eR_Changed        = AVC1394_RESP_CHANGED,
59         eR_Interim        = AVC1394_RESP_INTERIM,
60     };
61
62     enum ECommandType {
63         eCT_Control         = AVC1394_CTYP_CONTROL,
64         eCT_Status          = AVC1394_CTYP_STATUS,
65         eCT_SpecificInquiry = AVC1394_CTYP_SPECIFIC_INQUIRY,
66         eCT_Notify          = AVC1394_CTYP_NOTIFY,
67         eCT_GeneralInquiry  = AVC1394_CTYP_GENERAL_INQUIRY,
68         eCT_Unknown         = 0xff,
69     };
70
71     enum ESubunitType {
72         eST_Monitor       = AVC1394_SUBUNIT_VIDEO_MONITOR,
73         eST_Audio         = AVC1394_SUBUNIT_AUDIO,
74         eST_Printer       = AVC1394_SUBUNIT_PRINTER,
75         eST_Disc          = AVC1394_SUBUNIT_DISC_RECORDER,
76         eST_VCR           = AVC1394_SUBUNIT_VCR,
77         eST_Tuner         = AVC1394_SUBUNIT_TUNER,
78         eST_CA            = AVC1394_SUBUNIT_CA,
79         eST_Camera        = AVC1394_SUBUNIT_VIDEO_CAMERA,
80         eST_Panel         = AVC1394_SUBUNIT_PANEL,
81         eST_BulltinBoard  = AVC1394_SUBUNIT_BULLETIN_BOARD,
82         eST_CameraStorage = AVC1394_SUBUNIT_CAMERA_STORAGE,
83         eST_Music         = AVC1394_SUBUNIT_MUSIC,
84         eST_VendorUnique  = AVC1394_SUBUNIT_VENDOR_UNIQUE,
85         eST_Reserved      = AVC1394_SUBUNIT_RESERVED,
86         eST_Extended      = AVC1394_SUBUNIT_EXTENDED,
87         eST_Unit          = AVC1394_SUBUNIT_UNIT,
88     };
89
90     virtual bool serialize( IOSSerialize& se );
91     virtual bool deserialize( IISDeserialize& de );
92
93     virtual bool setCommandType( ECommandType commandType );
94     virtual bool fire();
95
96     EResponse getResponse();
97
98     bool setNodeId( fb_nodeid_t nodeId );
99     bool setSubunitType( ESubunitType subunitType );
100     bool setSubunitId( subunit_id_t subunitId );
101
102     ESubunitType getSubunitType();
103     subunit_id_t getSubunitId();
104
105     bool setVerbose( int verboseLevel );
106     int getVerboseLevel();
107
108     virtual const char* getCmdName() const = 0;
109
110     // workaround
111     static void setSleepAfterAVCCommand( int time );
112 protected:
113     void showFcpFrame( const unsigned char* buf,
114                        unsigned short frameSize ) const;
115
116 protected:
117     AVCCommand( Ieee1394Service* ieee1394service, opcode_t opcode );
118     virtual ~AVCCommand() {}
119
120     ECommandType getCommandType();
121
122     Ieee1394Service* m_1394Service;
123     fb_nodeid_t      m_nodeId;
124
125     fcp_frame_t      m_fcpFrame;
126
127 private:
128     ctype_t      m_ctype;
129     subunit_t    m_subunit;
130     opcode_t     m_opcode;
131     EResponse    m_eResponse;
132     int          m_verboseLevel;
133     ECommandType m_commandType;
134     static int   m_time;
135 };
136
137
138 const char* subunitTypeToString( subunit_type_t subunitType );
139
140 #endif // AVCGeneric_h
Note: See TracBrowser for help on using the browser.