root/trunk/freebob/src/avdevicesubunit.cpp

Revision 31, 2.2 kB (checked in by wagi, 19 years ago)

emacs has complained about the whitespaces, so there we go: whitespace-cleanup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* avdevicesubunit.cpp
2  * Copyright (C) 2004 by Pieter Palmers
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 #include <errno.h>
21 #include <libavc1394/avc1394.h>
22 #include <libavc1394/avc1394_vcr.h>
23 #include "debugmodule.h"
24 #include "avdevice.h"
25 #include "avdevicesubunit.h"
26
27
28 void AvDeviceSubunit::test() {
29
30 }
31
32
33 AvDeviceSubunit::AvDeviceSubunit(AvDevice *parent, unsigned char target, unsigned char  id)
34 {
35         unsigned char byte;
36         quadlet_t request[6];
37         quadlet_t *response;
38
39         cParent=parent;
40         iTarget=target;
41         iId=id;
42         iNbDestinationPlugs=0;
43         iNbSourcePlugs=0;
44
45         debugPrint (DEBUG_LEVEL_SUBUNIT,"AvDeviceSubunit target=%02X id=%02X created\n",target,id);
46
47         if (!cParent) {
48                 debugPrint (DEBUG_LEVEL_SUBUNIT,"AvDeviceSubunit: parent == NULL!\n");
49                 bValid=false;
50                 return;
51         }
52
53         bValid=true;
54
55         // check the number of I/O plugs
56
57         request[0] = AVC1394_CTYPE_STATUS | ((iTarget & 0x1F) << 19) | ((iId & 0x07) << 16)
58                                         | AVC1394_COMMAND_PLUG_INFO | 0x00;
59         request[1] = 0xFFFFFFFF;
60         response = cParent->avcExecuteTransaction(request, 2, 2);
61         if (response != NULL) {
62                 iNbDestinationPlugs= (unsigned char) ((response[1]>>24) & 0xff);
63                 iNbSourcePlugs= (unsigned char) ((response[1]>>16) & 0xff);
64         }
65         debugPrint (DEBUG_LEVEL_SUBUNIT,"AvDeviceSubunit: %d source plugs, %d destination plugs\n",iNbSourcePlugs,iNbDestinationPlugs);
66
67
68 }
69
70 AvDeviceSubunit::~AvDeviceSubunit()
71 {
72
73 }
74
75 bool AvDeviceSubunit::isValid()
76 {
77         return bValid;
78 }
79
80 unsigned char AvDeviceSubunit::getNbDestinationPlugs() {
81         return iNbDestinationPlugs;
82 }
83
84 unsigned char AvDeviceSubunit::getNbSourcePlugs() {
85         return iNbSourcePlugs;
86 }
Note: See TracBrowser for help on using the browser.