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 #include <Inventor/sys/port.h>
00025 #include <RemoteViz/Clients/nodes/LibHelper.h>
00026
00027 #include <Inventor/SbPImpl.h>
00028 #include <Inventor/SbString.h>
00029 #include <Inventor/SbVec.h>
00030 #include <Inventor/fields/SoSFString.h>
00031 #include <Inventor/fields/SoSFUShort.h>
00032 #include <Inventor/fields/SoSFBool.h>
00033 #include <Inventor/fields/SoMFVec2String.h>
00034 #include <Inventor/fields/SoSFEnum.h>
00035 #include <Inventor/fields/SoMFEnum.h>
00036 #include <Inventor/nodes/SoNode.h>
00037 #include <Inventor/SbEventHandler.h>
00038 #include <Inventor/SbEventArg.h>
00039
00040 class SoLocation2Event;
00041 class SoMouseButtonEvent;
00042 class SoMouseWheelEvent;
00043 class SoKeyboardEvent;
00044 class SoTouchEvent;
00045
00046 SO_PIMPL_BASE_PUBLIC_DECLARATION(SoRemoteVizClient);
00047
00065 class RVCLIENT_API SoRemoteVizClient : public SoNode
00066 {
00067
00068 SO_NODE_HEADER(SoRemoteVizClient);
00069
00070 SO_PIMPL_BASE_PUBLIC_HEADER(SoRemoteVizClient);
00071
00072 public:
00073
00075 enum DisplayMode {
00079 STRETCH ,
00083 CROP ,
00087 FIT
00088 };
00089
00091 enum VideoDecoder {
00095 NONE,
00100 OPENH264,
00106 INTEL_QUICKSYNC,
00113 NVDECODE,
00118 VPX
00119 };
00120
00122 enum StreamingMode
00123 {
00124
00125 UNKNOWN,
00126
00127 IMAGE,
00128
00129 VIDEO
00130 };
00131
00135 SoRemoteVizClient();
00136
00140 virtual ~SoRemoteVizClient();
00141
00142
00143
00149 SoSFBool connect;
00150
00155 SoSFString ipAddress;
00156
00161 SoSFUShort port;
00162
00167 SoSFString renderAreaName;
00168
00175 SoMFEnum videoDecoders;
00176
00184 SoMFVec2String connectionParameters;
00185
00190 SoSFEnum displayMode;
00191
00197 void sendMessage(const SbString& message);
00198
00216 void enableSecureConnection(const SbString& publicCertificateFilePath, const SbString& privateKeyFilePath, unsigned int enabledSecurityProtocols = TLSv1_1 | TLSv1_2 | TLSv1_3, const SbString& privateKeyPassphrase = "");
00217
00221 enum SecurityProtocols
00222 {
00223 SSLv2 = 0x1,
00224 SSLv3 = 0x2,
00225 TLSv1 = 0x4,
00226 TLSv1_1 = 0x8,
00227 TLSv1_2 = 0x10,
00228 TLSv1_3 = 0x20
00229 };
00230
00237 unsigned int getEnabledSecurityProtocols() const;
00238
00244 bool isSecureConnection() const;
00245
00252 void requestRenderAreaSize(const SbVec2s& size);
00253
00259 SbVec2s getRenderAreaSize() const;
00260
00266 SbVec2s getContainerSize() const;
00267
00273 bool isImageStreamingSupported() const;
00274
00280 bool isVideoStreamingSupported() const;
00281
00290 VideoDecoder getVideoDecoder() const;
00291
00299 StreamingMode getStreamingMode() const;
00300
00306 struct RVCLIENT_API ServiceMessageEventArg : public SbEventArg
00307 {
00308 enum State
00309 {
00310 CONNECTED,
00311 DISCONNECTED,
00312 START_NETWORK_CALIBRATION,
00313 FINISH_NETWORK_CALIBRATION,
00314 START_BANDWIDTH_CALIBRATION,
00315 FINISH_BANDWIDTH_CALIBRATION,
00316 START_LATENCY_CALIBRATION,
00317 FINISH_LATENCY_CALIBRATION
00318 };
00319
00321 ServiceMessageEventArg(SoRemoteVizClient* source, State state, SbVec2s renderAreaSize, const SbString& details)
00322 : m_source( source ), m_state( state ), m_renderAreaSize( renderAreaSize ), m_details( &details ) {}
00323
00325 SoRemoteVizClient* getSource() const { return m_source; }
00326
00328 State getState() const { return m_state; }
00329
00331 const SbVec2s& getRenderAreaSize() const { return m_renderAreaSize; }
00332
00343 const SbString& getDetails() const { return *m_details; }
00344
00345 private:
00346 SoRemoteVizClient* m_source;
00347 State m_state;
00348 SbVec2s m_renderAreaSize;
00349 const SbString* m_details;
00350 };
00351
00357 struct RVCLIENT_API MessageEventArg : public SbEventArg
00358 {
00360 MessageEventArg(SoRemoteVizClient* source, const SbString& message)
00361 : m_source(source), m_message(&message) {}
00362
00364 SoRemoteVizClient* getSource() const { return m_source; }
00365
00367 const SbString& getMessage() const { return *m_message; }
00368
00369 private:
00370 SoRemoteVizClient* m_source;
00371 const SbString* m_message;
00372 };
00373
00379 struct RVCLIENT_API RenderAreaSizeEventArg : public SbEventArg
00380 {
00382 RenderAreaSizeEventArg(SoRemoteVizClient* source, SbVec2s size)
00383 : m_source(source), m_size(size) {}
00384
00386 SoRemoteVizClient* getSource() const { return m_source; }
00387
00389 const SbVec2s& getSize() const { return m_size; }
00390
00391 private:
00392 SoRemoteVizClient* m_source;
00393 SbVec2s m_size;
00394 };
00395
00401 struct RVCLIENT_API FrameEventArg : public SbEventArg
00402 {
00404 FrameEventArg(SoRemoteVizClient* source, uint64_t id, uint64_t dataLength, bool isLossless, const SbString& message)
00405 : m_source(source), m_id(id), m_dataLength(dataLength), m_isLossless(isLossless), m_message(&message) {}
00406
00408 SoRemoteVizClient* getSource() const { return m_source; }
00409
00411 uint64_t getId() const { return m_id; }
00412
00414 uint64_t getDataLength() const { return m_dataLength; }
00415
00417 bool isLossless() const { return m_isLossless; }
00418
00420 const SbString& getMessage() const { return *m_message; }
00421
00422 private:
00423 SoRemoteVizClient* m_source;
00424 uint64_t m_id;
00425 uint64_t m_dataLength;
00426 bool m_isLossless;
00427 const SbString* m_message;
00428 };
00429
00435 struct RVCLIENT_API MouseLocationEventArg : public SbEventArg
00436 {
00438 MouseLocationEventArg(SoRemoteVizClient* source, SoLocation2Event* mouseLocationEvent)
00439 : m_source(source), m_mouseLocationEvent(mouseLocationEvent) {}
00440
00442 SoRemoteVizClient* getSource() const { return m_source; }
00443
00445 SoLocation2Event* getMouseLocationEvent() const { return m_mouseLocationEvent; }
00446
00447 private:
00448 SoRemoteVizClient* m_source;
00449 SoLocation2Event* m_mouseLocationEvent;
00450 };
00451
00457 struct RVCLIENT_API MouseButtonEventArg : public SbEventArg
00458 {
00460 MouseButtonEventArg(SoRemoteVizClient* source, SoMouseButtonEvent* mouseButtonEvent)
00461 : m_source(source), m_mouseButtonEvent(mouseButtonEvent) {}
00462
00464 SoRemoteVizClient* getSource() const { return m_source; }
00465
00467 SoMouseButtonEvent* getMouseButtonEvent() const { return m_mouseButtonEvent; }
00468
00469 private:
00470 SoRemoteVizClient* m_source;
00471 SoMouseButtonEvent* m_mouseButtonEvent;
00472 };
00473
00479 struct RVCLIENT_API MouseWheelEventArg : public SbEventArg
00480 {
00482 MouseWheelEventArg(SoRemoteVizClient* source, SoMouseWheelEvent* mouseWheelEvent)
00483 : m_source(source), m_mouseWheelEvent(mouseWheelEvent) {}
00484
00486 SoRemoteVizClient* getSource() const { return m_source; }
00487
00489 SoMouseWheelEvent* getMouseWheelEvent() const { return m_mouseWheelEvent; }
00490
00491 private:
00492 SoRemoteVizClient* m_source;
00493 SoMouseWheelEvent* m_mouseWheelEvent;
00494 };
00495
00501 struct RVCLIENT_API KeyboardEventArg : public SbEventArg
00502 {
00504 KeyboardEventArg(SoRemoteVizClient* source, SoKeyboardEvent* keyboardEvent)
00505 : m_source(source), m_keyboardEvent(keyboardEvent) {}
00506
00508 SoRemoteVizClient* getSource() const { return m_source; }
00509
00511 SoKeyboardEvent* getKeyboardEvent() const { return m_keyboardEvent; }
00512
00513 private:
00514 SoRemoteVizClient* m_source;
00515 SoKeyboardEvent* m_keyboardEvent;
00516 };
00517
00523 struct RVCLIENT_API TouchEventArg : public SbEventArg
00524 {
00526 TouchEventArg(SoRemoteVizClient* source, SoTouchEvent* touchEvent)
00527 : m_source(source), m_touchEvent(touchEvent) {}
00528
00530 SoRemoteVizClient* getSource() const { return m_source; }
00531
00533 SoTouchEvent* getTouchEvent() const { return m_touchEvent; }
00534
00535 private:
00536 SoRemoteVizClient* m_source;
00537 SoTouchEvent* m_touchEvent;
00538 };
00539
00543 SbEventHandler<ServiceMessageEventArg&> onServiceMessage;
00544
00548 SbEventHandler<MessageEventArg&> onReceivedMessage;
00549
00553 SbEventHandler<RenderAreaSizeEventArg&> onRenderAreaResize;
00554
00558 SbEventHandler<FrameEventArg&> onReceivedFrame;
00559
00563 SbEventHandler<FrameEventArg&> onDecodedFrame;
00564
00568 SbEventHandler<MouseLocationEventArg&> onMouseLocationEvent;
00569
00573 SbEventHandler<MouseButtonEventArg&> onMouseButtonEvent;
00574
00578 SbEventHandler<MouseWheelEventArg&> onMouseWheelEvent;
00579
00583 SbEventHandler<KeyboardEventArg&> onKeyboardEvent;
00584
00588 SbEventHandler<TouchEventArg&> onTouchEvent;
00589
00590 private:
00591
00592 static void initClass();
00593 static void exitClass();
00594
00595 private:
00599 virtual void notify(SoNotList *list);
00600
00604 virtual void doAction(SoAction *action);
00605
00609 virtual void GLRender(SoGLRenderAction *action);
00610
00614 virtual void handleEvent(SoHandleEventAction *action);
00615
00616
00617 private:
00618
00619 void construct();
00620 };
00621
00622 #endif // _SO_REMOTEVIZ_CLIENT_
00623
00624