1 |
/* |
---|
2 |
* Copyright (C) 2005-2008 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 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. |
---|
13 |
* |
---|
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. |
---|
18 |
* |
---|
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/>. |
---|
21 |
* |
---|
22 |
*/ |
---|
23 |
|
---|
24 |
#include "avc_vendor_dependent_cmd.h" |
---|
25 |
#include "libutil/cmd_serialize.h" |
---|
26 |
#include "libieee1394/ieee1394service.h" |
---|
27 |
|
---|
28 |
#include <netinet/in.h> |
---|
29 |
#include <iostream> |
---|
30 |
|
---|
31 |
using namespace std; |
---|
32 |
|
---|
33 |
#define AVC1394_CMD_VENDOR_DEPENDENT 0x00 |
---|
34 |
|
---|
35 |
namespace AVC { |
---|
36 |
|
---|
37 |
VendorDependentCmd::VendorDependentCmd(Ieee1394Service& ieee1394service) |
---|
38 |
: AVCCommand( ieee1394service, AVC1394_CMD_VENDOR_DEPENDENT ) |
---|
39 |
{ |
---|
40 |
} |
---|
41 |
|
---|
42 |
VendorDependentCmd::~VendorDependentCmd() |
---|
43 |
{ |
---|
44 |
} |
---|
45 |
|
---|
46 |
bool |
---|
47 |
VendorDependentCmd::serialize( Util::Cmd::IOSSerialize& se ) |
---|
48 |
{ |
---|
49 |
bool result=true; |
---|
50 |
result &= AVCCommand::serialize( se ); |
---|
51 |
byte_t tmp; |
---|
52 |
tmp=(m_companyId >> 16) & 0xFF; |
---|
53 |
result &= se.write(tmp,"VendorDependentCmd companyid[2]"); |
---|
54 |
tmp=(m_companyId >> 8) & 0xFF; |
---|
55 |
result &= se.write(tmp,"VendorDependentCmd companyid[1]"); |
---|
56 |
tmp=(m_companyId) & 0xFF; |
---|
57 |
result &= se.write(tmp,"VendorDependentCmd companyid[0]"); |
---|
58 |
return result; |
---|
59 |
} |
---|
60 |
|
---|
61 |
bool |
---|
62 |
VendorDependentCmd::deserialize( Util::Cmd::IISDeserialize& de ) |
---|
63 |
{ |
---|
64 |
bool result=true; |
---|
65 |
result &= AVCCommand::deserialize( de ); |
---|
66 |
|
---|
67 |
byte_t tmp[3]; |
---|
68 |
result &= de.read(&tmp[2]); |
---|
69 |
result &= de.read(&tmp[1]); |
---|
70 |
result &= de.read(&tmp[0]); |
---|
71 |
|
---|
72 |
m_companyId = (tmp[2] << 16) | (tmp[1]<<8) | tmp[0]; |
---|
73 |
|
---|
74 |
return result; |
---|
75 |
} |
---|
76 |
|
---|
77 |
} |
---|