root/trunk/libffado/src/bebob/focusrite/focusrite_cmd.cpp

Revision 618, 2.2 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) 2005-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 #include "focusrite_cmd.h"
25
26 #include <netinet/in.h>
27 #include <iostream>
28
29 using namespace std;
30 using namespace AVC;
31
32 namespace BeBoB {
33 namespace Focusrite {
34
35 FocusriteVendorDependentCmd::FocusriteVendorDependentCmd(Ieee1394Service& ieee1394service)
36     : VendorDependentCmd( ieee1394service )
37     , m_arg1 ( 0x03 )
38     , m_arg2 ( 0x01 )
39     , m_id ( 0x00000000 )
40     , m_value ( 0x00000000 )
41 {
42     m_companyId=0x00130e;
43 }
44
45 FocusriteVendorDependentCmd::~FocusriteVendorDependentCmd()
46 {
47 }
48
49 bool
50 FocusriteVendorDependentCmd::serialize( Util::IOSSerialize& se )
51 {
52     bool result=true;
53     result &= VendorDependentCmd::serialize( se );
54     result &= se.write(m_arg1,"FocusriteVendorDependentCmd arg1");
55     result &= se.write(m_arg2,"FocusriteVendorDependentCmd arg2");
56     // FIXME: this is not consistent, we should not have to care about ntohl here
57     result &= se.write(htonl(m_id),"FocusriteVendorDependentCmd ID");
58     result &= se.write(htonl(m_value),"FocusriteVendorDependentCmd value");
59    
60     return result;
61 }
62
63 bool
64 FocusriteVendorDependentCmd::deserialize( Util::IISDeserialize& de )
65 {
66     bool result=true;
67     result &= VendorDependentCmd::deserialize( de );
68     result &= de.read(&m_arg1);
69     result &= de.read(&m_arg2);
70     result &= de.read(&m_id);
71     m_id=ntohl(m_id);
72     result &= de.read(&m_value);
73     m_value=ntohl(m_value);
74
75     return result;
76 }
77
78 }
79 }
80
Note: See TracBrowser for help on using the browser.