00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _SO_REMOTEVIZ_CLIENT_
00022 #define _SO_REMOTEVIZ_CLIENT_
00023
00024 #if defined(_WIN32) || defined(__WIN32__)
00025 #if !defined( RemoteVizClient_EXPORTS )
00026 #if _DEBUG
00027 #pragma comment(lib,"RemoteVizClientD")
00028 #else
00029 #pragma comment(lib,"RemoteVizClient")
00030 #endif
00031 #endif
00032 #endif
00033
00034 #include <Inventor/sys/port.h>
00035
00036 #include <Inventor/SbPImpl.h>
00037 #include <Inventor/SbString.h>
00038 #include <Inventor/SbVec.h>
00039 #include <Inventor/fields/SoSFString.h>
00040 #include <Inventor/fields/SoSFUShort.h>
00041 #include <Inventor/fields/SoSFBool.h>
00042 #include <Inventor/fields/SoMFVec2String.h>
00043 #include <Inventor/fields/SoSFEnum.h>
00044 #include <Inventor/fields/SoMFEnum.h>
00045 #include <Inventor/nodes/SoNode.h>
00046 #include <Inventor/SbEventHandler.h>
00047 #include <Inventor/SbEventArg.h>
00048
00049 class SoLocation2Event;
00050 class SoMouseButtonEvent;
00051 class SoMouseWheelEvent;
00052 class SoKeyboardEvent;
00053 class SoTouchEvent;
00054 class SoRemoteVizClientImpl;
00055
00056 SO_PIMPL_BASE_PUBLIC_DECLARATION(SoRemoteVizClient);
00057
00075 class RVCLIENT_API SoRemoteVizClient : public SoNode
00076 {
00077
00078 SO_NODE_HEADER(SoRemoteVizClient);
00079
00080 SO_PIMPL_BASE_PUBLIC_HEADER(SoRemoteVizClient);
00081
00082 public:
00083
00085 enum DisplayMode {
00089 STRETCH ,
00093 CROP ,
00097 FIT
00098 };
00099
00101 enum VideoDecoder {
00105 NONE,
00110 OPENH264,
00116 INTEL_QUICKSYNC,
00123 NVDECODE
00124 };
00125
00127 enum StreamingMode
00128 {
00129
00130 UNKNOWN,
00131
00132 IMAGE,
00133
00134 VIDEO
00135 };
00136
00140 SoRemoteVizClient();
00141
00145 virtual ~SoRemoteVizClient();
00146
00147
00148
00154 SoSFBool connect;
00155
00160 SoSFString ipAddress;
00161
00166 SoSFUShort port;
00167
00172 SoSFString renderAreaName;
00173
00180 SoMFEnum videoDecoders;
00181
00189 SoMFVec2String connectionParameters;
00190
00195 SoSFEnum displayMode;
00196
00202 void sendMessage(const SbString& message);
00203
00221 void enableSecureConnection(const SbString& publicCertificateFilePath, const SbString& privateKeyFilePath, unsigned int enabledSecurityProtocols = TLSv1 | TLSv1_1 | TLSv1_2, const SbString& privateKeyPassphrase = "");
00222
00226 enum SecurityProtocols
00227 {
00228 SSLv2 = 0x1,
00229 SSLv3 = 0x2,
00230 TLSv1 = 0x4,
00231 TLSv1_1 = 0x8,
00232 TLSv1_2 = 0x10
00233 };
00234
00241 unsigned int getEnabledSecurityProtocols() const;
00242
00248 bool isSecureConnection() const;
00249
00256 void requestRenderAreaSize(const SbVec2s& size);
00257
00263 SbVec2s getRenderAreaSize();
00264
00270 SbVec2s getContainerSize();
00271
00277 bool isImageStreamingSupported();
00278
00284 bool isVideoStreamingSupported();
00285
00294 VideoDecoder getVideoDecoder();
00295
00303 StreamingMode getStreamingMode();
00304
00310 struct RVCLIENT_API ServiceMessageEventArg : public SbEventArg
00311 {
00312 enum State
00313 {
00314 CONNECTED,
00315 DISCONNECTED,
00316 START_NETWORK_CALIBRATION,
00317 FINISH_NETWORK_CALIBRATION,
00318 START_BANDWIDTH_CALIBRATION,
00319 FINISH_BANDWIDTH_CALIBRATION,
00320 START_LATENCY_CALIBRATION,
00321 FINISH_LATENCY_CALIBRATION
00322 };
00323
00325 ServiceMessageEventArg(SoRemoteVizClient* source, State state, SbVec2s renderAreaSize, const SbString& details)
00326 : m_source( source ), m_state( state ), m_renderAreaSize( renderAreaSize ), m_details( &details ) {}
00327
00329 SoRemoteVizClient* getSource() const { return m_source; }
00330
00332 State getState() const { return m_state; }
00333
00335 const SbVec2s& getRenderAreaSize() const { return m_renderAreaSize; }
00336
00347 const SbString& getDetails() const { return *m_details; }
00348
00349 private:
00350 SoRemoteVizClient* m_source;
00351 State m_state;
00352 SbVec2s m_renderAreaSize;
00353 const SbString* m_details;
00354 };
00355
00361 struct RVCLIENT_API MessageEventArg : public SbEventArg
00362 {
00364 MessageEventArg(SoRemoteVizClient* source, const SbString& message)
00365 : m_source(source), m_message(&message) {}
00366
00368 SoRemoteVizClient* getSource() const { return m_source; }
00369
00371 const SbString& getMessage() const { return *m_message; }
00372
00373 private:
00374 SoRemoteVizClient* m_source;
00375 const SbString* m_message;
00376 };
00377
00383 struct RVCLIENT_API RenderAreaSizeEventArg : public SbEventArg
00384 {
00386 RenderAreaSizeEventArg(SoRemoteVizClient* source, SbVec2s size)
00387 : m_source(source), m_size(size) {}
00388
00390 SoRemoteVizClient* getSource() const { return m_source; }
00391
00393 const SbVec2s& getSize() const { return m_size; }
00394
00395 private:
00396 SoRemoteVizClient* m_source;
00397 SbVec2s m_size;
00398 };
00399
00405 struct RVCLIENT_API FrameEventArg : public SbEventArg
00406 {
00408 FrameEventArg(SoRemoteVizClient* source, uint64_t id, uint64_t dataLength, bool isLossless, const SbString& message)
00409 : m_source(source), m_id(id), m_dataLength(dataLength), m_isLossless(isLossless), m_message(&message) {}
00410
00412 SoRemoteVizClient* getSource() const { return m_source; }
00413
00415 uint64_t getId() const { return m_id; }
00416
00418 uint64_t getDataLength() const { return m_dataLength; }
00419
00421 bool isLossless() const { return m_isLossless; }
00422
00424 const SbString& getMessage() const { return *m_message; }
00425
00426 private:
00427 SoRemoteVizClient* m_source;
00428 uint64_t m_id;
00429 uint64_t m_dataLength;
00430 bool m_isLossless;
00431 const SbString* m_message;
00432 };
00433
00439 struct RVCLIENT_API MouseLocationEventArg : public SbEventArg
00440 {
00442 MouseLocationEventArg(SoRemoteVizClient* source, SoLocation2Event* mouseLocationEvent)
00443 : m_source(source), m_mouseLocationEvent(mouseLocationEvent) {}
00444
00446 SoRemoteVizClient* getSource() const { return m_source; }
00447
00449 SoLocation2Event* getMouseLocationEvent() const { return m_mouseLocationEvent; }
00450
00451 private:
00452 SoRemoteVizClient* m_source;
00453 SoLocation2Event* m_mouseLocationEvent;
00454 };
00455
00461 struct RVCLIENT_API MouseButtonEventArg : public SbEventArg
00462 {
00464 MouseButtonEventArg(SoRemoteVizClient* source, SoMouseButtonEvent* mouseButtonEvent)
00465 : m_source(source), m_mouseButtonEvent(mouseButtonEvent) {}
00466
00468 SoRemoteVizClient* getSource() const { return m_source; }
00469
00471 SoMouseButtonEvent* getMouseButtonEvent() const { return m_mouseButtonEvent; }
00472
00473 private:
00474 SoRemoteVizClient* m_source;
00475 SoMouseButtonEvent* m_mouseButtonEvent;
00476 };
00477
00483 struct RVCLIENT_API MouseWheelEventArg : public SbEventArg
00484 {
00486 MouseWheelEventArg(SoRemoteVizClient* source, SoMouseWheelEvent* mouseWheelEvent)
00487 : m_source(source), m_mouseWheelEvent(mouseWheelEvent) {}
00488
00490 SoRemoteVizClient* getSource() const { return m_source; }
00491
00493 SoMouseWheelEvent* getMouseWheelEvent() const { return m_mouseWheelEvent; }
00494
00495 private:
00496 SoRemoteVizClient* m_source;
00497 SoMouseWheelEvent* m_mouseWheelEvent;
00498 };
00499
00505 struct RVCLIENT_API KeyboardEventArg : public SbEventArg
00506 {
00508 KeyboardEventArg(SoRemoteVizClient* source, SoKeyboardEvent* keyboardEvent)
00509 : m_source(source), m_keyboardEvent(keyboardEvent) {}
00510
00512 SoRemoteVizClient* getSource() const { return m_source; }
00513
00515 SoKeyboardEvent* getKeyboardEvent() const { return m_keyboardEvent; }
00516
00517 private:
00518 SoRemoteVizClient* m_source;
00519 SoKeyboardEvent* m_keyboardEvent;
00520 };
00521
00527 struct RVCLIENT_API TouchEventArg : public SbEventArg
00528 {
00530 TouchEventArg(SoRemoteVizClient* source, SoTouchEvent* touchEvent)
00531 : m_source(source), m_touchEvent(touchEvent) {}
00532
00534 SoRemoteVizClient* getSource() const { return m_source; }
00535
00537 SoTouchEvent* getTouchEvent() const { return m_touchEvent; }
00538
00539 private:
00540 SoRemoteVizClient* m_source;
00541 SoTouchEvent* m_touchEvent;
00542 };
00543
00547 SbEventHandler<ServiceMessageEventArg&> onServiceMessage;
00548
00552 SbEventHandler<MessageEventArg&> onReceivedMessage;
00553
00557 SbEventHandler<RenderAreaSizeEventArg&> onRenderAreaResize;
00558
00562 SbEventHandler<FrameEventArg&> onReceivedFrame;
00563
00567 SbEventHandler<FrameEventArg&> onDecodedFrame;
00568
00572 SbEventHandler<MouseLocationEventArg&> onMouseLocationEvent;
00573
00577 SbEventHandler<MouseButtonEventArg&> onMouseButtonEvent;
00578
00582 SbEventHandler<MouseWheelEventArg&> onMouseWheelEvent;
00583
00587 SbEventHandler<KeyboardEventArg&> onKeyboardEvent;
00588
00592 SbEventHandler<TouchEventArg&> onTouchEvent;
00593
00594 private:
00595
00596 static void initClass();
00597 static void exitClass();
00598
00599 private:
00603 virtual void notify(SoNotList *list);
00604
00608 virtual void doAction(SoAction *action);
00609
00613 virtual void GLRender(SoGLRenderAction *action);
00614
00618 virtual void handleEvent(SoHandleEventAction *action);
00619
00620
00621 private:
00622
00623 void construct();
00624 };
00625
00626 #endif // _SO_REMOTEVIZ_CLIENT_
00627
00628