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