root/branches/streaming-rework/src/libavc/avc_plug_info.cpp

Revision 413, 4.8 kB (checked in by pieterpalmers, 17 years ago)

- moved all generic IEEE1394 classes into libieee1394

src/libieee1394/ieee1394service.h
src/libieee1394/csr1212.h
src/libieee1394/configrom.cpp
src/libieee1394/configrom.h
src/libieee1394/ieee1394service.cpp
src/libieee1394/csr1212.c

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* avc_plug_info.cpp
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 #include "avc_plug_info.h"
22 #include "avc_serialize.h"
23 #include "libieee1394/ieee1394service.h"
24
25 #include <netinet/in.h>
26 #include <iostream>
27
28 using namespace std;
29
30 PlugInfoCmd::PlugInfoCmd( Ieee1394Service& ieee1394service,
31                           ESubFunction eSubFunction )
32     : AVCCommand( ieee1394service, AVC1394_CMD_PLUG_INFO )
33     , m_serialBusIsochronousInputPlugs( 0xff )
34     , m_serialBusIsochronousOutputPlugs( 0xff )
35     , m_externalInputPlugs( 0xff )
36     , m_externalOutputPlugs( 0xff )
37     , m_serialBusAsynchronousInputPlugs( 0xff )
38     , m_serialBusAsynchronousOuputPlugs( 0xff )
39     , m_destinationPlugs( 0xff )
40     , m_sourcePlugs( 0xff )
41     , m_subFunction( eSubFunction )
42 {
43 }
44
45 PlugInfoCmd::PlugInfoCmd( const PlugInfoCmd& rhs )
46     : AVCCommand( rhs )
47     , m_serialBusIsochronousInputPlugs( rhs.m_serialBusIsochronousInputPlugs )
48     , m_serialBusIsochronousOutputPlugs( rhs.m_serialBusIsochronousOutputPlugs )
49     , m_externalInputPlugs( rhs.m_externalInputPlugs )
50     , m_externalOutputPlugs( rhs.m_externalOutputPlugs )
51     , m_serialBusAsynchronousInputPlugs( rhs.m_serialBusAsynchronousInputPlugs )
52     , m_serialBusAsynchronousOuputPlugs( rhs.m_serialBusAsynchronousOuputPlugs )
53     , m_destinationPlugs( rhs.m_destinationPlugs )
54     , m_sourcePlugs( rhs.m_sourcePlugs )
55     , m_subFunction( rhs.m_subFunction )
56 {
57 }
58
59 PlugInfoCmd::~PlugInfoCmd()
60 {
61 }
62
63 bool
64 PlugInfoCmd::serialize( IOSSerialize& se )
65 {
66     byte_t reserved = 0xff;
67
68     AVCCommand::serialize( se );
69     se.write( m_subFunction, "PlugInfoCmd subFunction" );
70     switch( getSubunitType() ) {
71     case eST_Unit:
72         switch( m_subFunction ) {
73         case eSF_SerialBusIsochronousAndExternalPlug:
74             se.write( m_serialBusIsochronousInputPlugs, "PlugInfoCmd serialBusIsochronousInputPlugs" );
75             se.write( m_serialBusIsochronousOutputPlugs, "PlugInfoCmd serialBusIsochronousOutputPlugs" );
76             se.write( m_externalInputPlugs, "PlugInfoCmd externalInputPlugs" );
77             se.write( m_externalOutputPlugs, "PlugInfoCmd externalOutputPlugs" );
78             break;
79         case eSF_SerialBusAsynchonousPlug:
80             se.write( m_serialBusAsynchronousInputPlugs, "PlugInfoCmd serialBusAsynchronousInputPlugs" );
81             se.write( m_serialBusAsynchronousOuputPlugs, "PlugInfoCmd serialBusAsynchronousOuputPlugs" );
82             se.write( reserved, "PlugInfoCmd" );
83             se.write( reserved, "PlugInfoCmd" );
84             break;
85         default:
86             cerr << "Could not serialize with subfucntion " << m_subFunction << endl;
87             return false;
88         }
89         break;
90     default:
91         se.write( m_destinationPlugs, "PlugInfoCmd destinationPlugs" );
92         se.write( m_sourcePlugs, "PlugInfoCmd sourcePlugs" );
93         se.write( reserved, "PlugInfoCmd" );
94         se.write( reserved, "PlugInfoCmd" );
95     }
96     return true;
97 }
98
99 bool
100 PlugInfoCmd::deserialize( IISDeserialize& de )
101 {
102     byte_t reserved;
103
104     AVCCommand::deserialize( de );
105     de.read( &m_subFunction );
106     switch ( getSubunitType() ) {
107     case eST_Unit:
108         switch ( m_subFunction ) {
109         case eSF_SerialBusIsochronousAndExternalPlug:
110             de.read( &m_serialBusIsochronousInputPlugs );
111             de.read( &m_serialBusIsochronousOutputPlugs );
112             de.read( &m_externalInputPlugs );
113             de.read( &m_externalOutputPlugs );
114             break;
115         case eSF_SerialBusAsynchonousPlug:
116             de.read( &m_serialBusAsynchronousInputPlugs );
117             de.read( &m_serialBusAsynchronousOuputPlugs );
118             de.read( &reserved );
119             de.read( &reserved );
120             break;
121         default:
122             cerr << "Could not deserialize with subfunction " << m_subFunction << endl;
123             return false;
124         }
125         break;
126     default:
127         de.read( &m_destinationPlugs );
128         de.read( &m_sourcePlugs );
129         de.read( &reserved );
130         de.read( &reserved );
131     }
132     return true;
133 }
134
135 bool
136 PlugInfoCmd::setSubFunction( ESubFunction subFunction )
137 {
138     m_subFunction = subFunction;
139     return true;
140 }
Note: See TracBrowser for help on using the browser.