motu: the 4pre channel layout within packets is now believed to be correct. Thanks...
[ffado.git] / libffado / src / fireworks / efc / efc_avc_cmd.cpp
blob6c7b7acb46541a62885aa06aa51cbf849fa2b62b
1 /*
2 * Copyright (C) 2005-2008 by Pieter Palmers
4 * This file is part of FFADO
5 * FFADO = Free Firewire (pro-)audio drivers for linux
7 * FFADO is based upon FreeBoB
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) version 3 of the License.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "efc_avc_cmd.h"
26 #include "libutil/ByteSwap.h"
27 #include <iostream>
29 using namespace std;
30 using namespace AVC;
32 namespace FireWorks {
34 EfcOverAVCCmd::EfcOverAVCCmd(Ieee1394Service& ieee1394service)
35 : VendorDependentCmd( ieee1394service )
36 , m_dummy_1 ( 0 )
37 , m_dummy_2 ( 0 )
38 , m_cmd( NULL )
40 m_companyId=0x0;
43 EfcOverAVCCmd::~EfcOverAVCCmd()
47 bool
48 EfcOverAVCCmd::serialize( Util::Cmd::IOSSerialize& se )
50 if (m_cmd==NULL) {
51 debugError("no child EFC command\n");
52 return false;
54 bool result=true;
55 result &= VendorDependentCmd::serialize( se );
57 result &= se.write(m_dummy_1, "Dummy byte 1");
58 result &= se.write(m_dummy_2, "Dummy byte 1");
60 result &= m_cmd->serialize( se );
62 if(!result) {
63 debugWarning("Serialization failed\n");
66 return result;
69 bool
70 EfcOverAVCCmd::deserialize( Util::Cmd::IISDeserialize& de )
72 if (m_cmd==NULL) {
73 debugError("no child EFC command\n");
74 return false;
76 bool result=true;
77 result &= VendorDependentCmd::deserialize( de );
79 result &= de.read(&m_dummy_1);
80 result &= de.read(&m_dummy_2);
82 if(!result) {
83 debugWarning("AV/C deserialization failed\n");
84 return false;
87 result &= m_cmd->deserialize( de );
89 if(!result) {
90 debugWarning("Deserialization failed\n");
93 return result;
96 } // namespace FireWorks