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 #ifndef __OPAL_H281HANDLER_H
00034 #define __OPAL_H281HANDLER_H
00035
00036 #ifdef P_USE_PRAGMA
00037 #pragma interface
00038 #endif
00039
00040 #ifndef _PTLIB_H
00041 #include <ptlib.h>
00042 #endif
00043
00044 #include <h224/h224handler.h>
00045 #include <h224/h281.h>
00046
00047 class OpalH224Handler;
00048
00052 class H281VideoSource : public PObject
00053 {
00054 PCLASSINFO(H281VideoSource, PObject);
00055
00056 public:
00057
00058 H281VideoSource();
00059 ~H281VideoSource();
00060
00061 BOOL IsEnabled() const { return isEnabled; }
00062 void SetEnabled(BOOL flag) { isEnabled = flag; }
00063
00064 BYTE GetVideoSourceNumber() const { return (firstOctet >> 4) & 0x0f; }
00065 void SetVideoSourceNumber(BYTE number);
00066
00067 BOOL CanMotionVideo() const { return (firstOctet >> 2) & 0x01; }
00068 void SetCanMotionVideo(BOOL flag);
00069
00070 BOOL CanNormalResolutionStillImage() const { return (firstOctet >> 1) & 0x01; }
00071 void SetCanNormalResolutionStillImage(BOOL flag);
00072
00073 BOOL CanDoubleResolutionStillImage() const { return (firstOctet & 0x01); }
00074 void SetCanDoubleResolutionStillImage(BOOL flag);
00075
00076 BOOL CanPan() const { return (secondOctet >> 7) & 0x01; }
00077 void SetCanPan(BOOL flag);
00078
00079 BOOL CanTilt() const { return (secondOctet >> 6) & 0x01; }
00080 void SetCanTilt(BOOL flag);
00081
00082 BOOL CanZoom() const { return (secondOctet >> 5) & 0x01; }
00083 void SetCanZoom(BOOL flag);
00084
00085 BOOL CanFocus() const { return (secondOctet >> 4) & 0x01; }
00086 void SetCanFocus(BOOL flag);
00087
00088 void Encode(BYTE *data) const;
00089 BOOL Decode(const BYTE *data);
00090
00091 protected:
00092
00093 BOOL isEnabled;
00094 BYTE firstOctet;
00095 BYTE secondOctet;
00096
00097 };
00098
00101 class OpalH281Handler : public PObject
00102 {
00103 PCLASSINFO(OpalH281Handler, PObject);
00104
00105 public:
00106
00107 OpalH281Handler(OpalH224Handler & h224Handler);
00108 ~OpalH281Handler();
00109
00110 enum VideoSource {
00111 CurrentVideoSource = 0x00,
00112 MainCamera = 0x01,
00113 AuxiliaryCamera = 0x02,
00114 DocumentCamera = 0x03,
00115 AuxiliaryDocumentCamera = 0x04,
00116 VideoPlaybackSource = 0x05
00117 };
00118
00119 BOOL GetRemoteHasH281() const { return remoteHasH281; }
00120 void SetRemoteHasH281(BOOL flag) { remoteHasH281 = flag; }
00121
00122 BYTE GetLocalNumberOfPresets() const { return localNumberOfPresets; }
00123 void SetLocalNumberOfPresets(BYTE presets) { localNumberOfPresets = presets; }
00124
00125 BYTE GetRemoteNumberOfPresets() const { return remoteNumberOfPresets; }
00126
00127 H281VideoSource & GetLocalVideoSource(VideoSource source);
00128 H281VideoSource & GetRemoteVideoSource(VideoSource source);
00129
00133 void StartAction(H281_Frame::PanDirection panDirection,
00134 H281_Frame::TiltDirection tiltDirection,
00135 H281_Frame::ZoomDirection zoomDireciton,
00136 H281_Frame::FocusDirection focusDirection);
00137
00140 void StopAction();
00141
00146 void SelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode);
00147
00151 void StoreAsPreset(BYTE presetNumber);
00152
00155 void ActivatePreset(BYTE presetNumber);
00156
00162 void SendExtraCapabilities() const;
00163
00166 void OnReceivedExtraCapabilities(const BYTE *capabilities, PINDEX size);
00167 void OnReceivedMessage(const H281_Frame & message);
00168
00169
00170
00171
00172
00173
00174
00177 virtual void OnRemoteCapabilitiesUpdated();
00178
00181 virtual void OnStartAction(H281_Frame::PanDirection panDirection,
00182 H281_Frame::TiltDirection tiltDirection,
00183 H281_Frame::ZoomDirection zoomDirection,
00184 H281_Frame::FocusDirection focusDirection);
00185
00188 virtual void OnStopAction();
00189
00192 virtual void OnSelectVideoSource(BYTE videoSourceNumber, H281_Frame::VideoMode videoMode);
00193
00196 virtual void OnStoreAsPreset(BYTE presetNumber);
00197
00200 virtual void OnActivatePreset(BYTE presetNumber);
00201
00202 protected:
00203
00204 PDECLARE_NOTIFIER(PTimer, OpalH281Handler, ContinueAction);
00205 PDECLARE_NOTIFIER(PTimer, OpalH281Handler, StopActionLocally);
00206
00207 OpalH224Handler & h224Handler;
00208 BOOL remoteHasH281;
00209 BYTE localNumberOfPresets;
00210 BYTE remoteNumberOfPresets;
00211 H281VideoSource localVideoSources[6];
00212 H281VideoSource remoteVideoSources[6];
00213
00214 H281_Frame transmitFrame;
00215 PTimer transmitTimer;
00216
00217 H281_Frame::PanDirection requestedPanDirection;
00218 H281_Frame::TiltDirection requestedTiltDirection;
00219 H281_Frame::ZoomDirection requestedZoomDirection;
00220 H281_Frame::FocusDirection requestedFocusDirection;
00221 PTimer receiveTimer;
00222 };
00223
00224 #endif // __OPAL_H281HANDLER_H
00225