root/trunk/freebob/src/ieee1394service.h

Revision 57, 3.3 kB (checked in by wagi, 19 years ago)

Use Ieee1394Service::avcExecuteTransaction instead of AvDevice::avcExecuteTransaction

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* ieee1394service.h
2  * Copyright (C) 2004 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 #ifndef IEEE1394SERVICE_H
21 #define IEEE1394SERVICE_H
22
23 #include <libraw1394/raw1394.h>
24 #include <libavc1394/rom1394.h>
25 #include <pthread.h>
26
27 #include "freebob.h"
28 #include "debugmodule.h"
29
30 /* XXX: add those to avc1394.h */
31 #define AVC1394_SUBUNIT_TYPE_AUDIO (1 <<19)     
32 #define AVC1394_SUBUNIT_TYPE_PRINTER (2 <<19)   
33 #define AVC1394_SUBUNIT_TYPE_CA (6 <<19)         
34 #define AVC1394_SUBUNIT_TYPE_PANEL (9 <<19)     
35 #define AVC1394_SUBUNIT_TYPE_BULLETIN_BOARD (0xA <<19)   
36 #define AVC1394_SUBUNIT_TYPE_CAMERA_STORAGE (0xB <<19)   
37 #define AVC1394_SUBUNIT_TYPE_MUSIC (0xC <<19)   
38          
39 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_GENERAL     (1<<0)     
40 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_AUDIO       (1<<1)     
41 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_MIDI        (1<<2)     
42 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_SMPTE       (1<<3)     
43 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_SAMPLECOUNT (1<<4)     
44 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_AUDIOSYNC   (1<<5)     
45 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_RESERVED    (1<<6)     
46 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_MORE        (1<<7)     
47          
48 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_NONBLOCKING (1<<0)     
49 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_BLOCKING    (1<<1)     
50          
51 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_AUDIOSYNC_BUS      (1<<0)       
52 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_AUDIOSYNC_EXTERNAL (1<<0)       
53  
54 class Ieee1394Service {
55  public:
56     FBReturnCodes initialize();
57     void shutdown();
58
59     static Ieee1394Service* instance();
60     FBReturnCodes discoveryDevices( unsigned int iGenerationCount );
61
62     unsigned int getGenerationCount();
63
64     quadlet_t * avcExecuteTransaction( int node_id,
65                                        quadlet_t *request,
66                                        unsigned int request_len,
67                                        unsigned int response_len );
68
69  protected:
70     static int resetHandler( raw1394handle_t handle,
71                              unsigned int iGeneration );
72     void setGenerationCount( unsigned int iGeneration );
73
74     bool startRHThread();
75     void stopRHThread();
76     static void* rHThread( void* arg );
77
78     void printAvcUnitInfo( int iNodeId );
79     void printRomDirectory( int iNodeId,  rom1394_directory* pRomDir );
80
81     void avDeviceTests( octlet_t oGuid, int iPort, int iNodeId );
82  private:
83     Ieee1394Service();
84     ~Ieee1394Service();
85
86     static Ieee1394Service* m_pInstance;
87     raw1394handle_t m_handle;
88     raw1394handle_t m_rhHandle;
89     int m_iPort;                  // XXX dw: port in 1394 service makes no sense
90     bool m_bInitialised;
91     pthread_t m_thread;
92     pthread_mutex_t m_mutex;
93     bool m_bRHThreadRunning;
94     unsigned int m_iGenerationCount;
95
96     DECLARE_DEBUG_MODULE;
97 };
98
99 #endif
Note: See TracBrowser for help on using the browser.