root/trunk/libfreebob/src/libfreebobavc/ieee1394service.cpp

Revision 130, 2.3 kB (checked in by wagi, 17 years ago)

* tests/test-freebob.c (main): Debug info added.

* src/libfreebobavc/ieee1394service.cpp (initialize): Use
raw1394_new_handle_on_port instead of raw1394_new_handle and
raw1394_set_port.

* src/devicemanager.cpp (initialize): After deleteing 1394 service
clear also pointer.

* libfreebob/freebob.h: freebob_direction enum names changed
members which jack backed freebob needs to freebob_connection added

* configure.ac: Update library version depency.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* tempate.cpp
2  * Copyright (C) 2005 by Daniel Wagner
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 "ieee1394service.h"
21
22 #include <libavc1394/avc1394.h>
23
24 #include <errno.h>
25
26 #include <iostream>
27
28 using namespace std;
29
30 Ieee1394Service::Ieee1394Service()
31     : m_handle( 0 )
32     , m_port( -1 )
33 {
34 }
35
36 Ieee1394Service::~Ieee1394Service()
37 {
38 }
39
40 bool
41 Ieee1394Service::initialize( int port )
42 {
43     m_handle = raw1394_new_handle_on_port( port );
44     if ( !m_handle ) {
45         if ( !errno ) {
46             cerr << "libraw1394 not compatible" << endl;
47         } else {
48             perror( "Ieee1394Service::initialize: Could not get 1394 handle" );
49             cerr << "Is ieee1394 and raw1394 driver loaded?" << endl;
50         }
51         return false;
52     }
53
54     m_port = port;
55     return true;
56 }
57
58 int
59 Ieee1394Service::getNodeCount()
60 {
61     return raw1394_get_nodecount( m_handle );
62 }
63
64 bool
65 Ieee1394Service::read( fb_nodeid_t nodeId,
66                        fb_nodeaddr_t addr,
67                        size_t size,
68                        fb_quadlet_t* buffer )
69 {
70     return raw1394_read( m_handle, nodeId, addr,  size,  buffer ) != 0;
71 }
72
73 bool
74 Ieee1394Service::write( fb_nodeid_t   nodeId,
75                         fb_nodeaddr_t addr,
76                         size_t        length,
77                         fb_quadlet_t  *data )
78 {
79     return raw1394_write( m_handle, nodeId, addr, length, data ) != 0;
80 }
81
82 fb_quadlet_t*
83 Ieee1394Service::transactionBlock( fb_nodeid_t nodeId,
84                                    fb_quadlet_t* buf,
85                                    int len )
86 {
87     return avc1394_transaction_block( m_handle, nodeId, buf, len,  1 );
88 }
Note: See TracBrowser for help on using the browser.