1/*
2 * Copyright (c) 1998-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License").  You may not use this file except in compliance with the
9 * License.  Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 *  IOFireWireLibIsochChannel.h
24 *  IOFireWireFamily
25 *
26 *  Created on Mon Mar 12 2001.
27 *  Copyright (c) 2001-2002 Apple Computer, Inc. All rights reserved.
28 *
29 */
30
31#import "IOFireWireLibIUnknown.h"
32#import "IOFireWireLibPriv.h"
33#import "IOFireWireLibIsoch.h"
34
35namespace IOFireWireLib {
36
37	class Device ;
38	class IsochChannel: public IOFireWireIUnknown
39	{
40		protected:
41			typedef ::IOFireWireLibIsochChannelRef 				ChannelRef ;
42			typedef ::IOFireWireIsochChannelForceStopHandler	ForceStopHandler ;
43
44		public:
45			IsochChannel( const IUnknownVTbl & interface, Device& userclient, bool inDoIRM, IOByteCount inPacketSize, IOFWSpeed inPrefSpeed) ;
46			virtual ~IsochChannel() ;
47
48		public:
49			// --- other methods
50			virtual IOReturn 			SetTalker( IOFireWireLibIsochPortRef talker ) ;
51			virtual IOReturn			AddListener( IOFireWireLibIsochPortRef listener ) ;
52
53			virtual IOReturn			AllocateChannel() ;
54			virtual IOReturn 			ReleaseChannel() ;
55			virtual IOReturn			Start() ;
56			virtual IOReturn			Stop() ;
57
58			virtual ForceStopHandler	SetChannelForceStopHandler( ForceStopHandler stopProc, IOFireWireLibIsochChannelRef interface ) ;
59			virtual void	 			SetRefCon( void* stopProcRefCon ) ;
60			virtual void*				GetRefCon() ;
61
62			virtual Boolean				NotificationIsOn() ;
63			virtual Boolean				TurnOnNotification( IOFireWireLibIsochChannelRef interface ) ;
64			virtual void				TurnOffNotification() ;
65
66			virtual void				ClientCommandIsComplete( FWClientCommandID commandID, IOReturn status ) ;
67
68		protected:
69//			static void					ForceStop( ChannelRef refcon, IOReturn result, void** args, int numArgs ) ;
70
71		protected:
72			Device&						mUserClient ;
73			UserObjectHandle			mKernChannelRef ;
74			Boolean						mNotifyIsOn ;
75			ForceStopHandler			mForceStopHandler ;
76			void*						mUserRefCon ;
77			IOFireWireLibIsochPortRef	mTalker ;
78			CFMutableArrayRef			mListeners ;
79			ChannelRef					mRefInterface ;
80			IOFWSpeed					mSpeed ;
81			IOFWSpeed					mPrefSpeed ;
82			UInt32						mChannel ;
83	} ;
84
85	class IsochChannelCOM: public IsochChannel
86	{
87			typedef ::IOFireWireIsochChannelInterface		Interface ;
88
89		public:
90			IsochChannelCOM( Device& userclient, bool inDoIRM, IOByteCount inPacketSize, IOFWSpeed inPrefSpeed ) ;
91			virtual ~IsochChannelCOM() ;
92
93		private:
94			static Interface sInterface ;
95
96		public:
97			static IUnknownVTbl**	Alloc( Device&	inUserClient, Boolean inDoIRM, IOByteCount inPacketSize, IOFWSpeed inPrefSpeed) ;
98			virtual HRESULT			QueryInterface( REFIID iid, void ** ppv ) ;
99
100		protected:
101			static IOReturn			SSetTalker(
102											ChannelRef 	self,
103											IOFireWireLibIsochPortRef 		talker) ;
104			static IOReturn 		SAddListener(
105											ChannelRef 	self,
106											IOFireWireLibIsochPortRef 		listener) ;
107			static IOReturn 		SAllocateChannel(
108											ChannelRef 	self) ;
109			static IOReturn			SReleaseChannel(
110											ChannelRef 	self) ;
111			static IOReturn 		SStart(
112											ChannelRef 	self) ;
113			static IOReturn			SStop(
114											ChannelRef 	self) ;
115			static ForceStopHandler
116									SSetChannelForceStopHandler(
117											ChannelRef 	self,
118											ForceStopHandler stopProc) ;
119			static void		 		SSetRefCon(
120											ChannelRef 	self,
121											void* 							stopProcRefCon) ;
122			static void*			SGetRefCon(
123											ChannelRef 	self) ;
124			static Boolean			SNotificationIsOn(
125											ChannelRef 	self) ;
126			static Boolean			STurnOnNotification(
127											ChannelRef 	self) ;
128			static void				STurnOffNotification(
129											ChannelRef	self) ;
130			static void				SClientCommandIsComplete(
131											ChannelRef 	self,
132											FWClientCommandID 				commandID,
133											IOReturn 						status) ;
134	} ;
135}
136