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 #include <Inventor/devices/SoCpuBufferObject.h>
00040
00041 class SoLocation2Event;
00042 class SoMouseButtonEvent;
00043 class SoMouseWheelEvent;
00044 class SoKeyboardEvent;
00045 class SoTouchEvent;
00046
00047 SO_PIMPL_BASE_PUBLIC_DECLARATION(SoRemoteVizClient);
00048
00066 class RVCLIENT_API SoRemoteVizClient : public SoNode
00067 {
00068
00069 SO_NODE_HEADER(SoRemoteVizClient);
00070
00071 SO_PIMPL_BASE_PUBLIC_HEADER(SoRemoteVizClient);
00072
00073 public:
00074
00076 enum DisplayMode {
00080 STRETCH ,
00084 CROP ,
00088 FIT
00089 };
00090
00092 enum VideoDecoder {
00096 NONE,
00101 OPENH264,
00107 INTEL_QUICKSYNC,
00114 NVDECODE,
00119 VPX
00120 };
00121
00123 enum StreamingMode
00124 {
00125
00126 UNKNOWN,
00127
00128 IMAGE,
00129
00130 VIDEO
00131 };
00132
00136 SoRemoteVizClient();
00137
00141 virtual ~SoRemoteVizClient();
00142
00143
00144
00150 SoSFBool connect;
00151
00156 SoSFString ipAddress;
00157
00162 SoSFUShort port;
00163
00168 SoSFString renderAreaName;
00169
00176 SoMFEnum videoDecoders;
00177
00185 SoMFVec2String connectionParameters;
00186
00191 SoSFEnum displayMode;
00192
00198 void sendMessage(const SbString& message);
00199
00205 void sendMessage(SoCpuBufferObject* buffer);
00206
00224 void enableSecureConnection(const SbString& publicCertificateFilePath, const SbString& privateKeyFilePath, unsigned int enabledSecurityProtocols = TLSv1_1 | TLSv1_2 | TLSv1_3, const SbString& privateKeyPassphrase = "");
00225
00229 enum SecurityProtocols
00230 {
00231 SSLv2 = 0x1,
00232 SSLv3 = 0x2,
00233 TLSv1 = 0x4,
00234 TLSv1_1 = 0x8,
00235 TLSv1_2 = 0x10,
00236 TLSv1_3 = 0x20
00237 };
00238
00245 unsigned int getEnabledSecurityProtocols() const;
00246
00252 bool isSecureConnection() const;
00253
00260 void requestRenderAreaSize(const SbVec2s& size);
00261
00267 SbVec2s getRenderAreaSize() const;
00268
00274 SbVec2s getContainerSize() const;
00275
00281 bool isImageStreamingSupported() const;
00282
00288 bool isVideoStreamingSupported() const;
00289
00298 VideoDecoder getVideoDecoder() const;
00299
00307 StreamingMode getStreamingMode() const;
00308
00314 struct RVCLIENT_API ServiceMessageEventArg : public SbEventArg
00315 {
00316 enum State
00317 {
00319 CONNECTED,
00321 DISCONNECTED,
00323 START_NETWORK_CALIBRATION,
00325 FINISH_NETWORK_CALIBRATION,
00327 START_BANDWIDTH_CALIBRATION,
00329 FINISH_BANDWIDTH_CALIBRATION,
00331 START_LATENCY_CALIBRATION,
00333 FINISH_LATENCY_CALIBRATION,
00335 PENDING_NETWORK_CALIBRATION
00336 };
00337
00339 ServiceMessageEventArg(SoRemoteVizClient* source, State state, SbVec2s renderAreaSize, const SbString& details)
00340 : m_source( source ), m_state( state ), m_renderAreaSize( renderAreaSize ), m_details( &details ) {}
00341
00343 SoRemoteVizClient* getSource() const { return m_source; }
00344
00346 State getState() const { return m_state; }
00347
00349 const SbVec2s& getRenderAreaSize() const { return m_renderAreaSize; }
00350
00361 const SbString& getDetails() const { return *m_details; }
00362
00363 private:
00364 SoRemoteVizClient* m_source;
00365 State m_state;
00366 SbVec2s m_renderAreaSize;
00367 const SbString* m_details;
00368 };
00369
00375 struct RVCLIENT_API MessageEventArg : public SbEventArg
00376 {
00378 MessageEventArg(SoRemoteVizClient* source, const SbString& message)
00379 : m_source(source), m_message(&message) {}
00380
00382 SoRemoteVizClient* getSource() const { return m_source; }
00383
00385 const SbString& getMessage() const { return *m_message; }
00386
00387 private:
00388 SoRemoteVizClient* m_source;
00389 const SbString* m_message;
00390 };
00391
00397 struct RVCLIENT_API BinaryMessageEventArg : public SbEventArg
00398 {
00400 BinaryMessageEventArg(SoRemoteVizClient* source, SoCpuBufferObject* buffer)
00401 : m_source(source), m_buffer(buffer) {}
00402
00404 SoRemoteVizClient* getSource() const {return m_source;}
00405
00407 SoCpuBufferObject* getBuffer() const {return m_buffer;}
00408
00409 private:
00410 SoRemoteVizClient* m_source;
00411 SoCpuBufferObject* m_buffer;
00412 };
00413
00419 struct RVCLIENT_API RenderAreaSizeEventArg : public SbEventArg
00420 {
00422 RenderAreaSizeEventArg(SoRemoteVizClient* source, SbVec2s size)
00423 : m_source(source), m_size(size) {}
00424
00426 SoRemoteVizClient* getSource() const { return m_source; }
00427
00429 const SbVec2s& getSize() const { return m_size; }
00430
00431 private:
00432 SoRemoteVizClient* m_source;
00433 SbVec2s m_size;
00434 };
00435
00441 struct RVCLIENT_API FrameEventArg : public SbEventArg
00442 {
00444 FrameEventArg(SoRemoteVizClient* source, uint64_t id, uint64_t dataLength, bool isLossless, const SbString& message)
00445 : m_source(source), m_id(id), m_dataLength(dataLength), m_isLossless(isLossless), m_message(&message) {}
00446
00448 SoRemoteVizClient* getSource() const { return m_source; }
00449
00451 uint64_t getId() const { return m_id; }
00452
00454 uint64_t getDataLength() const { return m_dataLength; }
00455
00457 bool isLossless() const { return m_isLossless; }
00458
00460 const SbString& getMessage() const { return *m_message; }
00461
00462 private:
00463 SoRemoteVizClient* m_source;
00464 uint64_t m_id;
00465 uint64_t m_dataLength;
00466 bool m_isLossless;
00467 const SbString* m_message;
00468 };
00469
00475 struct RVCLIENT_API MouseLocationEventArg : public SbEventArg
00476 {
00478 MouseLocationEventArg(SoRemoteVizClient* source, SoLocation2Event* mouseLocationEvent)
00479 : m_source(source), m_mouseLocationEvent(mouseLocationEvent) {}
00480
00482 SoRemoteVizClient* getSource() const { return m_source; }
00483
00485 SoLocation2Event* getMouseLocationEvent() const { return m_mouseLocationEvent; }
00486
00487 private:
00488 SoRemoteVizClient* m_source;
00489 SoLocation2Event* m_mouseLocationEvent;
00490 };
00491
00497 struct RVCLIENT_API MouseButtonEventArg : public SbEventArg
00498 {
00500 MouseButtonEventArg(SoRemoteVizClient* source, SoMouseButtonEvent* mouseButtonEvent)
00501 : m_source(source), m_mouseButtonEvent(mouseButtonEvent) {}
00502
00504 SoRemoteVizClient* getSource() const { return m_source; }
00505
00507 SoMouseButtonEvent* getMouseButtonEvent() const { return m_mouseButtonEvent; }
00508
00509 private:
00510 SoRemoteVizClient* m_source;
00511 SoMouseButtonEvent* m_mouseButtonEvent;
00512 };
00513
00519 struct RVCLIENT_API MouseWheelEventArg : public SbEventArg
00520 {
00522 MouseWheelEventArg(SoRemoteVizClient* source, SoMouseWheelEvent* mouseWheelEvent)
00523 : m_source(source), m_mouseWheelEvent(mouseWheelEvent) {}
00524
00526 SoRemoteVizClient* getSource() const { return m_source; }
00527
00529 SoMouseWheelEvent* getMouseWheelEvent() const { return m_mouseWheelEvent; }
00530
00531 private:
00532 SoRemoteVizClient* m_source;
00533 SoMouseWheelEvent* m_mouseWheelEvent;
00534 };
00535
00541 struct RVCLIENT_API KeyboardEventArg : public SbEventArg
00542 {
00544 KeyboardEventArg(SoRemoteVizClient* source, SoKeyboardEvent* keyboardEvent)
00545 : m_source(source), m_keyboardEvent(keyboardEvent) {}
00546
00548 SoRemoteVizClient* getSource() const { return m_source; }
00549
00551 SoKeyboardEvent* getKeyboardEvent() const { return m_keyboardEvent; }
00552
00553 private:
00554 SoRemoteVizClient* m_source;
00555 SoKeyboardEvent* m_keyboardEvent;
00556 };
00557
00563 struct RVCLIENT_API TouchEventArg : public SbEventArg
00564 {
00566 TouchEventArg(SoRemoteVizClient* source, SoTouchEvent* touchEvent)
00567 : m_source(source), m_touchEvent(touchEvent) {}
00568
00570 SoRemoteVizClient* getSource() const { return m_source; }
00571
00573 SoTouchEvent* getTouchEvent() const { return m_touchEvent; }
00574
00575 private:
00576 SoRemoteVizClient* m_source;
00577 SoTouchEvent* m_touchEvent;
00578 };
00579
00583 SbEventHandler<ServiceMessageEventArg&> onServiceMessage;
00584
00588 SbEventHandler<MessageEventArg&> onReceivedMessage;
00589
00593 SbEventHandler<BinaryMessageEventArg&> onReceivedBinaryMessage;
00594
00598 SbEventHandler<RenderAreaSizeEventArg&> onRenderAreaResize;
00599
00603 SbEventHandler<FrameEventArg&> onReceivedFrame;
00604
00608 SbEventHandler<FrameEventArg&> onDecodedFrame;
00609
00613 SbEventHandler<MouseLocationEventArg&> onMouseLocationEvent;
00614
00618 SbEventHandler<MouseButtonEventArg&> onMouseButtonEvent;
00619
00623 SbEventHandler<MouseWheelEventArg&> onMouseWheelEvent;
00624
00628 SbEventHandler<KeyboardEventArg&> onKeyboardEvent;
00629
00633 SbEventHandler<TouchEventArg&> onTouchEvent;
00634
00635 private:
00636
00637 static void initClass();
00638 static void exitClass();
00639
00640 private:
00644 virtual void notify(SoNotList *list);
00645
00649 virtual void doAction(SoAction *action);
00650
00654 virtual void GLRender(SoGLRenderAction *action);
00655
00659 virtual void handleEvent(SoHandleEventAction *action);
00660
00661
00662 private:
00663
00664 void construct();
00665 };
00666
00667 #endif // _SO_REMOTEVIZ_CLIENT_
00668
00669