00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef __OPAL_H281HANDLER_H
00037 #define __OPAL_H281HANDLER_H
00038
00039 #ifdef P_USE_PRAGMA
00040 #pragma interface
00041 #endif
00042
00043 #include <ptlib.h>
00044 #include <h224handler.h>
00045 #include <h281.h>
00046
00047 #ifdef _MSC_VER
00048 #pragma warning(disable : 4244)
00049 #endif
00050
00051 class OpalH224Handler;
00052
00056 class H281VideoSource : public PObject
00057 {
00058 PCLASSINFO(H281VideoSource, PObject);
00059
00060 public:
00061
00062 H281VideoSource();
00063 ~H281VideoSource();
00064
00065 BOOL IsEnabled() const { return isEnabled; }
00066 void SetEnabled(BOOL flag) { isEnabled = flag; }
00067
00068 BYTE GetVideoSourceNumber() const { return (firstOctet >> 4) & 0x0f; }
00069 void SetVideoSourceNumber(BYTE number);
00070
00071 BOOL CanMotionVideo() const { return (firstOctet >> 2) & 0x01; }
00072 void SetCanMotionVideo(BOOL flag);
00073
00074 BOOL CanNormalResolutionStillImage() const { return (firstOctet >> 1) & 0x01; }
00075 void SetCanNormalResolutionStillImage(BOOL flag);
00076
00077 BOOL CanDoubleResolutionStillImage() const { return (firstOctet & 0x01); }
00078 void SetCanDoubleResolutionStillImage(BOOL flag);
00079
00080 BOOL CanPan() const { return (secondOctet >> 7) & 0x01; }
00081 void SetCanPan(BOOL flag);
00082
00083 BOOL CanTilt() const { return (secondOctet >> 6) & 0x01; }
00084 void SetCanTilt(BOOL flag);
00085
00086 BOOL CanZoom() const { return (secondOctet >> 5) & 0x01; }
00087 void SetCanZoom(BOOL flag);
00088
00089 BOOL CanFocus() const { return (secondOctet >> 4) & 0x01; }
00090 void SetCanFocus(BOOL flag);
00091
00092 void Encode(BYTE *data) const;
00093 BOOL Decode(const BYTE *data);
00094
00095 protected:
00096
00097 BOOL isEnabled;
00098 BYTE firstOctet;
00099 BYTE secondOctet;
00100
00101 };
00102
00105 class OpalH281Handler : public PObject
00106 {
00107 PCLASSINFO(OpalH281Handler, PObject);
00108
00109 public:
00110
00111 OpalH281Handler(OpalH224Handler & h224Handler);
00112 ~OpalH281Handler();
00113
00114 enum VideoSource {
00115 CurrentVideoSource = 0x00,
00116 MainCamera = 0x01,
00117 AuxiliaryCamera = 0x02,
00118 DocumentCamera = 0x03,
00119 AuxiliaryDocumentCamera = 0x04,
00120 VideoPlaybackSource = 0x05
00121 };
00122
00123 BOOL GetRemoteHasH281() const { return remoteHasH281; }
00124 void SetRemoteHasH281(BOOL flag) { remoteHasH281 = flag; }
00125
00126 BYTE GetLocalNumberOfPresets() const { return localNumberOfPresets; }
00127 void SetLocalNumberOfPresets(BYTE presets) { localNumberOfPresets = presets; }
00128
00129 BYTE GetRemoteNumberOfPresets() const { return remoteNumberOfPresets; }
00130
00131 H281VideoSource & GetLocalVideoSource(VideoSource source);
00132 H281VideoSource & GetRemoteVideoSource(VideoSource source);
00133
00137 void StartAction(H281_Frame::PanDirection panDirection,
00138 H281_Frame::TiltDirection tiltDirection,
00139 H281_Frame::ZoomDirection zoomDireciton,
00140 H281_Frame::FocusDirection focusDirection);
00141
00144 void StopAction();
00145
00150 void SelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode);
00151
00155 void StoreAsPreset(BYTE presetNumber);
00156
00159 void ActivatePreset(BYTE presetNumber);
00160
00166 void SendExtraCapabilities() const;
00167
00170 void OnReceivedExtraCapabilities(const BYTE *capabilities, PINDEX size);
00171 void OnReceivedMessage(const H281_Frame & message);
00172
00173
00174
00175
00176
00177
00178
00181 virtual void OnRemoteCapabilitiesUpdated();
00182
00185 virtual void OnStartAction(H281_Frame::PanDirection panDirection,
00186 H281_Frame::TiltDirection tiltDirection,
00187 H281_Frame::ZoomDirection zoomDirection,
00188 H281_Frame::FocusDirection focusDirection);
00189
00192 virtual void OnStopAction();
00193
00196 virtual void OnSelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode);
00197
00200 virtual void OnStoreAsPreset(BYTE presetNumber);
00201
00204 virtual void OnActivatePreset(BYTE presetNumber);
00205
00206 protected:
00207
00208 PDECLARE_NOTIFIER(PTimer, OpalH281Handler, ContinueAction);
00209 PDECLARE_NOTIFIER(PTimer, OpalH281Handler, StopActionLocally);
00210
00211 OpalH224Handler & h224Handler;
00212 BOOL remoteHasH281;
00213 BYTE localNumberOfPresets;
00214 BYTE remoteNumberOfPresets;
00215 H281VideoSource localVideoSources[6];
00216 H281VideoSource remoteVideoSources[6];
00217
00218 H281_Frame transmitFrame;
00219 PTimer transmitTimer;
00220
00221 H281_Frame::PanDirection requestedPanDirection;
00222 H281_Frame::TiltDirection requestedTiltDirection;
00223 H281_Frame::ZoomDirection requestedZoomDirection;
00224 H281_Frame::FocusDirection requestedFocusDirection;
00225 PTimer receiveTimer;
00226 };
00227
00228 #endif // __OPAL_H281HANDLER_H
00229