root/trunk/libffado/src/libavc/descriptors/avc_descriptor_cmd.h

Revision 618, 3.1 kB (checked in by ppalmers, 13 years ago)

move serialization routines to libutil such that they can be used for non-AVC stuff too (fireworks EFC)

Line 
1 /*
2  * Copyright (C) 2007 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1, as published by the Free Software Foundation;
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301 USA
22  */
23
24 #ifndef AVCDESCRIPTORCMD_H
25 #define AVCDESCRIPTORCMD_H
26
27 #include "../general/avc_generic.h"
28
29 #include <libavc1394/avc1394.h>
30
31 namespace AVC {
32
33
34 // defined in avc1394.h
35 // #define AVC1394_CMD_OPEN_DESCRIPTOR         0x08
36 // #define AVC1394_CMD_READ_DESCRIPTOR         0x09
37 // #define AVC1394_CMD_WRITE_DESCRIPTOR        0x0A
38 // #define AVC1394_CMD_SEARCH_DESCRIPTOR       0x0B
39 // #define AVC1394_CMD_OBJECT_NUMBER_SELECT    0x0D
40
41 // not yet defined
42 #define AVC1394_CMD_CREATE_DESCRIPTOR       0x0C
43 #define AVC1394_CMD_OPEN_INFOBLOCK          0x05
44 #define AVC1394_CMD_READ_INFOBLOCK          0x06
45 #define AVC1394_CMD_WRITE_INFOBLOCK         0x07
46
47 class AVCDescriptorSpecifier;
48
49 class OpenDescriptorCmd: public AVCCommand
50 {
51 public:
52     enum EMode {
53         eClose = 0x00,
54         eRead  = 0x01,
55         eWrite = 0x03,
56     };
57    
58     enum EStatus {
59         eReady          = 0x00,
60         eReadOpened     = 0x01,
61         eNonExistent    = 0x04,
62         eListOnly       = 0x05,
63         eAtCapacity     = 0x11,
64         eWriteOpened    = 0x33,
65     };
66  
67     OpenDescriptorCmd(Ieee1394Service& );
68     virtual ~OpenDescriptorCmd();
69
70     virtual bool serialize( Util::IOSSerialize& se );
71     virtual bool deserialize( Util::IISDeserialize& de );
72
73     virtual bool clear();
74
75     virtual const char* getCmdName() const
76     { return "OpenDescriptorCmd"; }
77
78     virtual void setMode( enum EMode m ) {m_mode=m;};
79     AVCDescriptorSpecifier *m_specifier;
80     enum EMode m_mode;
81
82     byte_t m_status;
83     byte_t m_reserved;
84     uint16_t m_locked_node_id;
85    
86 private:
87 };
88
89 class ReadDescriptorCmd: public AVCCommand
90 {
91 public:
92     enum EReadStatus {
93         eComplete     = 0x10,
94         eMoreToRead   = 0x11,
95         eTooLarge     = 0x12,
96         eInvalid      = 0xFF,
97     };
98
99     ReadDescriptorCmd(Ieee1394Service& ieee1394service);
100     virtual ~ReadDescriptorCmd();
101
102     virtual bool serialize( Util::IOSSerialize& se );
103     virtual bool deserialize( Util::IISDeserialize& de );
104    
105     virtual bool clear();
106    
107     enum EReadStatus getStatus();
108
109     virtual const char* getCmdName() const
110     { return "ReadDescriptorCmd"; }
111    
112     byte_t   m_status;
113     byte_t   m_reserved;
114     uint16_t m_data_length;
115     uint16_t m_address;
116    
117     byte_t *m_data;
118    
119     AVCDescriptorSpecifier *m_specifier;
120 private:
121
122 };
123
124 }
125
126 #endif // AVCDESCRIPTORCMD_H
Note: See TracBrowser for help on using the browser.