CN112486700B - Communication method, device and storage medium - Google Patents

Communication method, device and storage medium Download PDF

Info

Publication number
CN112486700B
CN112486700B CN202011315034.1A CN202011315034A CN112486700B CN 112486700 B CN112486700 B CN 112486700B CN 202011315034 A CN202011315034 A CN 202011315034A CN 112486700 B CN112486700 B CN 112486700B
Authority
CN
China
Prior art keywords
interface
function
data
platform
wpf
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011315034.1A
Other languages
Chinese (zh)
Other versions
CN112486700A (en
Inventor
桑新柱
叶韵菲
张泷
邢树军
沈圣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing University of Posts and Telecommunications
Original Assignee
Beijing University of Posts and Telecommunications
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing University of Posts and Telecommunications filed Critical Beijing University of Posts and Telecommunications
Priority to CN202011315034.1A priority Critical patent/CN112486700B/en
Publication of CN112486700A publication Critical patent/CN112486700A/en
Application granted granted Critical
Publication of CN112486700B publication Critical patent/CN112486700B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a communication method, a device and a storage medium, wherein the method comprises the following steps: determining data to be transferred, and setting the data to be transferred as an incoming parameter of a viewpoint setting function provided by an OSG interface; and calling the viewpoint setting function, and transmitting the data to be transmitted contained in the input parameters of the viewpoint setting function to an OSG interface so that the OSG interface can set the viewpoint based on the data to be transmitted. According to the communication method, the device and the storage medium, the data to be transmitted is set as the input parameters of the viewpoint setting function provided by the OSG interface, the viewpoint setting function is called, the data to be transmitted contained in the input parameters of the viewpoint setting function is transmitted to the OSG interface, the data transmission from the WPF platform to the OSG interface is realized, and the communication efficiency is high and the operation is stable.

Description

Communication method, device and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a communication method, apparatus, and storage medium.
Background
With the continuous popularization and development of the video monitoring networking system, the network camera is widely applied to the monitoring system, particularly the development and application of the network camera are faster in the coming of the high-definition era. While the number of monitoring cameras is increasing, monitoring systems face a serious current problem: mass videos are scattered, isolated, incomplete in view angle, ambiguous in position and the like. How to more intuitively and clearly manage cameras and control video dynamics has become an important topic for improving video application value. In this regard, the prior art creates a multi-source information fusion three-dimensional visual platform by utilizing a three-dimensional video fusion technology, and realizes real-time dynamic visual monitoring of a three-dimensional scene.
The multi-source information fusion three-dimensional visualization platform may include a number of functions: linkage of two three-dimensional maps, fusion and embedding of videos, switching of large and small scenes, linkage of small scenes and two-dimensional maps, simulation of weather and time, viewpoint roaming and the like. The implementation of the above functions depends on communication and data transfer among the three components of WPF, OSG and Unity. However, no complete set of communication modes can realize data transfer among WPF, OSG and Unity.
Disclosure of Invention
The invention provides a communication method, a device and a storage medium, which are used for solving the defect that a complete communication mode is not available in the prior art for realizing data transfer between WPF and OSG and Unity.
The invention provides a communication method, which is applied to a WPF platform and comprises the following steps:
determining data to be transferred, and setting the data to be transferred as an incoming parameter of a viewpoint setting function provided by an OSG interface;
and calling the viewpoint setting function, and transmitting the data to be transmitted contained in the input parameters of the viewpoint setting function to an OSG interface so that the OSG interface can set the viewpoint based on the data to be transmitted.
According to the communication method provided by the invention, the communication method further comprises the following steps:
based on the built-in Unity executable program, the data to be transferred are transmitted to the Unity platform in a message format through a socket.
The invention provides a communication method, which is applied to an OSG interface and comprises the following steps:
receiving the mandate of an interface update function which is transmitted when the WPF platform calls a viewpoint setting function provided by an OSG interface;
determining data to be transferred, and setting the data to be transferred as an incoming parameter of the interface updating function;
based on the hosting of the interface updating function, calling the interface updating function through a callback function, and transmitting the data to be transmitted contained in the input parameters of the interface updating function to a WPF platform so that the WPF platform can display the data to be transmitted.
According to the communication method provided by the invention, the interface updating function is called through a callback function based on the hosting of the interface updating function, and the communication method concretely comprises the following steps:
converting the host of the interface updating function into a function pointer corresponding to the interface updating function;
and calling the interface updating function through a callback function based on the function pointer corresponding to the interface updating function.
The invention provides a communication method, which is applied to a Unity platform and comprises the following steps:
based on the socket embedded in the Unity program script, the data to be transferred are transmitted to the WPF platform in a message format.
The invention provides a communication method, which comprises the following steps:
transmitting data to be transmitted to the WPF platform in a message format based on a socket embedded in a Unity program script of the Unity platform;
and the WPF platform sets the received data to be transferred as the input parameters of the viewpoint setting function provided by the OSG interface, and then calls the viewpoint setting function to transmit the data to be transferred contained in the input parameters of the viewpoint setting function to the OSG interface.
According to the communication method provided by the invention, the communication method further comprises the following steps:
after the OSG interface receives the mandate of the interface updating function transmitted when the WPF platform calls the viewpoint setting function, determining data to be transmitted, and setting the data to be transmitted as the transmitted parameters of the interface updating function;
the OSG interface calls the interface updating function through a callback function based on the hosting of the interface updating function, and the data to be transferred contained in the input parameters of the interface updating function are transmitted to the WPF platform;
the WPF platform transmits the data to be transmitted to the Unity platform in a message format through a socket based on a built-in Unity executable program.
The invention also provides a communication device deployed in the WPF platform, comprising:
the first parameter transmission determining unit is used for determining data to be transmitted and setting the data to be transmitted as the input parameters of the viewpoint setting function provided by the OSG interface;
and the function calling unit is used for calling the viewpoint setting function and transmitting the data to be transmitted contained in the input parameters of the viewpoint setting function to an OSG interface so that the OSG interface can set the viewpoint based on the data to be transmitted.
The invention also provides a communication device deployed in an OSG interface, comprising:
the function receiving unit to be called is used for receiving the mandate of the interface updating function which is transmitted when the WPF platform calls the viewpoint setting function provided by the OSG interface;
the second parameter transmission unit is used for determining data to be transmitted and setting the data to be transmitted as the input parameters of the interface updating function;
and the reverse call function unit is used for calling the interface updating function through a callback function based on the hosting of the interface updating function, and transmitting the data to be transmitted contained in the input parameters of the interface updating function to the WPF platform so as to enable the WPF platform to display and process the data to be transmitted.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of any of the communication methods described above.
According to the communication method, the device and the storage medium, the data to be transmitted is set as the input parameters of the viewpoint setting function provided by the OSG interface, the viewpoint setting function is called, the data to be transmitted contained in the input parameters of the viewpoint setting function is transmitted to the OSG interface, the data transmission from the WPF platform to the OSG interface is realized, and the communication efficiency is high and the operation is stable.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a communication method from a WPF platform to an OSG interface provided by the present invention;
fig. 2 is a schematic flow chart of a communication method from an OSG interface to a WPF platform provided by the present invention;
FIG. 3 is a flow chart of a communication method between the Unity platform and the OSG interface provided by the invention;
FIG. 4 is a schematic diagram of a communication device according to the present invention;
fig. 5 is a second schematic structural diagram of the communication device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In order to more intuitively and clearly manage cameras and control video dynamics, the prior art creates a multi-source information fusion three-dimensional visualization platform by using a three-dimensional video fusion technology, and realizes real-time dynamic visualization monitoring of three-dimensional scenes. The multi-source information fusion three-dimensional visualization platform may include a number of functions: linkage of two three-dimensional maps, fusion and embedding of videos, switching of large and small scenes, linkage of small scenes and two-dimensional maps, simulation of weather and time, viewpoint roaming and the like. The entire three-dimensional visualization platform framework is provided by WPF (Windows Presentation Foundation), and the framework provides osgwindows and unitywindows for loading Unity windows and OSG (OpenSceneGraph application program interface) windows. Thus, the implementation of the above functions depends on communication and data transfer among the three components WPF, OSG and Unity. However, there is currently no complete set of communication means that can achieve data transfer between WPF and OSG and Unity.
In this regard, the embodiment of the invention provides a communication method. Fig. 1 is a flow chart of a communication method from a WPF platform to an OSG interface according to an embodiment of the present invention, as shown in fig. 1, where the method is applied to the WPF platform, and the method includes:
step 110, determining data to be transferred, and setting the data to be transferred as the input parameters of the viewpoint setting function provided by the OSG interface;
and 120, calling a viewpoint setting function, and transmitting data to be transmitted contained in the input parameters of the viewpoint setting function to an OSG interface for the OSG interface to set the viewpoint based on the data to be transmitted.
Specifically, the data to be transferred that needs to be transferred into the OSG interface is first determined. For example, the data to be transferred may be parameter information such as the name and longitude and latitude of the model being operated in the WPF platform. In order to transmit the data to be transferred to the OSG interface, the data communication between the two platforms can be implemented in a function call manner. In particular, considering that the purpose of the WPF platform to transmit data into the OSG is to set a viewpoint in the OSG generally, the WPF platform may take the data to be transferred as an incoming parameter of a viewpoint setting function provided by the OSG to the outside, and directly call the viewpoint setting function, so that the OSG interface performs viewpoint setting based on the incoming data to be transferred. When the WPF calls the viewpoint setting function, the data to be transferred is transferred into the viewpoint setting function in the manner of the input parameters, so that the OSG interface can acquire the data to be transferred in the input parameters when executing the viewpoint setting function, and the data transfer from the WPF platform to the OSG interface is realized.
According to the method provided by the embodiment of the invention, the data to be transferred is set as the input parameters of the viewpoint setting function provided by the OSG interface, the viewpoint setting function is called, and the data to be transferred contained in the input parameters of the viewpoint setting function is transmitted to the OSG interface, so that the data transfer from the WPF platform to the OSG interface is realized, and the communication efficiency is high and the operation is stable.
Based on the above embodiment, the method further includes:
based on the built-in Unity executable program, the data to be transferred is transmitted to the Unity platform in a message format through a socket.
Specifically, in the current communication method, in order to transfer data between the WPF platform and the Unity platform, it is generally implemented using a UnityWebPlayer plug-in. However, the UnityWebPlayer plugin is essentially a plugin for playing the Unity page stream on the webpage, which has the problem of slow loading, and reduces the communication efficiency between the WPF platform and the Unity platform. Therefore, in order to improve communication efficiency, the embodiment of the invention realizes data transfer between the WPF platform and the Unity platform by using a message communication mode.
Here, the executable program generated by the Unity may be embedded in the WPF program in advance, and the WPF platform serves as a server side, and the Unity platform itself serves as a client side. When data transmission is needed, the data to be transmitted is packaged into a message, and then the built-in Unity executable program can send the message packaged with the data to be transmitted to the Unity platform through a socket. The message format may be a UDP protocol message or a TCP protocol message, which is not specifically limited in the embodiment of the present invention.
According to the method provided by the embodiment of the invention, the data to be transmitted is packaged into the message, and the message is sent to the Unity through the socket, so that the communication efficiency between the WPF platform and the Unity platform is improved.
Based on any of the above embodiments, fig. 2 is a flow chart of a communication method from an OSG interface to a WPF platform according to an embodiment of the present invention, as shown in fig. 2, where the method is applied to the OSG interface, and the method includes:
step 210, receiving the host of an interface update function which is transmitted when the WPF platform calls a viewpoint setting function provided by an OSG interface;
step 220, determining data to be transferred, and setting the data to be transferred as an input parameter of an interface updating function;
step 230, based on the hosting of the interface updating function, the interface updating function is called through the callback function, and the data to be transferred contained in the input parameters of the interface updating function is transmitted to the WPF platform, so that the WPF platform can display the data to be transferred.
Specifically, after the WPF platform invokes the viewpoint setting function provided by the OSG interface, the OSG interface processes data carried in the input parameters of the viewpoint setting function, and returns new data to be transferred, for example, whether a desired model is selected, relevant information of the model, and the like. It should be noted that, when the WPF platform invokes the viewpoint setting function, the incoming parameters include not only the transmitted data itself, but also function hosting provided by the WPF platform for processing the data returned by the OSG, that is, hosting of the interface update function. The WPF platform synchronously transmits the host of the interface updating function to the OSG interface in the mode of the input parameters, so that the OSG interface can transmit the data to be transmitted back to the WPF platform in the mode of function call by means of the interface updating function.
Therefore, after the mandate of the interface update function which is transmitted when the WPF platform calls the viewpoint setting function provided by the OSG interface is received, the data to be transmitted is used as the transmission parameter of the interface update function provided by the WPF platform, and the interface update function is called through the callback function so that the WPF platform can update the interface based on the transmission data. When the OSG calls the interface updating function through the callback function, the data to be transferred is transferred to the inside of the interface updating function in the mode of the input parameter, so that the OSG interface can acquire the data to be transferred in the input parameter when executing the interface updating function, and the data transfer from the OSG interface to the WPF platform is realized.
In addition, when the OSG interface calls the interface update function provided by the WPF through the callback function, the interface update function needs to change the interface of the front end. However, at this point the UI object at the front end is being occupied by the UI thread in the WPF platform, resulting in an inability to update the front end interface. For this, a Dispatcher object of the UI in the WPF platform may be used, and an invoke method of the Dispatcher object may be called, and the interface update function may be submitted to the method to execute, so as to implement the update of the front-end interface.
According to the method provided by the embodiment of the invention, the data to be transferred is set as the input parameters of the interface updating function input by the WPF platform, and the interface updating function is called by the callback function, so that the data to be transferred contained in the input parameters of the interface updating function is transferred to the WPF platform, the data transfer from the OSG interface to the WPF platform is realized, and the communication efficiency is high and the operation is stable.
Based on any of the foregoing embodiments, in step 230, based on the hosting of the interface update function, the interface update function is called by the callback function, which specifically includes:
converting the host of the interface updating function into a function pointer corresponding to the interface updating function;
and calling the interface updating function through the callback function based on the function pointer corresponding to the interface updating function.
Specifically, since the WPF platform is written in the c# language and the OSG interface is written in the c++, the OSG interface cannot directly make function calls according to the hosting of the interface update function. Therefore, the host of the interface update function needs to be converted into a form which can be understood by the OSG interface, that is, into a function pointer corresponding to the interface update function. For example, the hosting of the interface update function may be converted to an IntPtr type, which in turn is converted to a function pointer of the corresponding type. And then, calling the interface updating function through the callback function according to the function pointer corresponding to the interface updating function.
Before converting the host of the interface update function, a corresponding callback function and a function pointer corresponding to the callback function form may be declared in the OSG in advance. At the same time, it is also necessary to declare a host corresponding to the function pointer of the OSG in the WPF platform, and to give the interface update function provided by the WPF platform to the host for delivery to the corresponding function pointer in the OSG.
For example, a function pointer named MessageCallback may be first declared in the class of OSGH and a class variable_ mcb of this type may be declared in OSG and. Then, an interface update function CallBackFunc to be called is prepared in the WPF platform, and a message callback type of managed is created, and the initialization value of the managed is called a message callbackdelete. After the WPF platform calls a viewpoint setting function and transmits the managed MessageCallBackDelegate to an OSG interface, the OSG interface firstly converts the managed into an IntPtr type, then converts the IntPtr type into a function pointer corresponding to the MessageCallBack and consistent with the MessageCallBack, assigns the function pointer to a variable_ mcb in the OSGhand ler class, and then the OSG interface updates the function CallBackFunc through a callback function call interface. In this way, after the callback function is used in the OSG platform, the interface update function provided by the WPF platform is directly triggered, so that data transfer from the OSG interface to the WPF platform is realized. In addition, since the C# has a garbage recycling mechanism, in order to prevent the managed messagecallbackDelegate from being recycled in advance, a keepAlive method can be called to ensure that the managed corresponding interface update function survives.
Based on any one of the foregoing embodiments, a further embodiment of the present invention provides a communication method, where the method is applied to a Unity platform, and the method includes:
based on the socket embedded in the Unity program script, the data to be transferred are transmitted to the WPF platform in a message format.
Specifically, socket content can be embedded in a Unity program script of a Unity platform in advance, the Unity platform is taken as a client, and a Unity executable program embedded in the WPF platform is taken as a server. When data transmission is needed, the data to be transmitted is packaged into a message, and then the message packaged with the data to be transmitted is sent to the WPF platform through a socket embedded in a Unity program script. The message format may be a UDP protocol message or a TCP protocol message, which is not specifically limited in the embodiment of the present invention.
According to the method provided by the embodiment of the invention, the data to be transmitted is packaged into the message, and the message is sent to the WPF platform through the socket, so that the communication efficiency between the WPF platform and the Unity platform is improved.
Based on any of the foregoing embodiments, another embodiment of the present invention provides a communication method, including:
transmitting data to be transmitted to the WPF platform in a message format based on a socket embedded in a Unity program script of the Unity platform;
after the WPF platform sets the received data to be transferred as the input parameters of the viewpoint setting function provided by the OSG interface, the viewpoint setting function is called, and the data to be transferred contained in the input parameters of the viewpoint setting function is transmitted to the OSG interface.
Specifically, the Unity platform and the OSG interface may communicate indirectly through WPF as a medium, i.e. the Unity platform first transmits the data to be transferred to the WPF platform, and the WPF platform transmits the data to be transferred to the OSG interface. Fig. 3 is a flow chart of a communication method between a Unity platform and an OSG interface provided by the embodiment of the present invention, as shown in fig. 3, the Unity platform uses a socket embedded in a Unity program script to transmit data to be transmitted to a WPF platform through a message, and a specific transmission manner may be the communication method from the Unity platform to the WPF platform provided by any one of the embodiments, which is not described herein. After the WPF receives the data to be transferred, the data to be transferred is set as an input parameter of a viewpoint setting function provided by the OSG interface, the viewpoint setting function is called, the data to be transferred included in the input parameter of the viewpoint setting function is transferred to the OSG interface, and a specific transfer mode may be a communication method from the WPF platform to the OSG interface provided by any embodiment, which is not described herein again.
According to the method provided by the embodiment of the invention, the WPF is used as a medium, the Unity platform transmits the data to be transmitted to the WPF platform, and the WPF platform transmits the data to be transmitted to the OSG interface, so that the communication between the Unity platform and the OSG interface can be realized.
Based on any of the above embodiments, the method further comprises:
after the OSG interface receives the mandate of the interface updating function transmitted when the WPF platform calls the viewpoint setting function, determining data to be transmitted, and setting the data to be transmitted as the transmitted parameters of the interface updating function;
the OSG interface calls the interface updating function through a callback function based on the hosting of the interface updating function, and transmits data to be transmitted contained in the input parameters of the interface updating function to the WPF platform;
the WPF platform transmits data to be transmitted to the Unity platform in a message format through a socket based on a built-in Unity executable program.
Specifically, when the OSG interface needs to transfer data to the Unity platform, the WPF platform may still be used as a medium to implement indirect communication between the OSG interface and the Unity platform. As shown in fig. 3, after the OSG interface receives the hosting of the interface update function that is input when the WPF platform invokes the viewpoint setting function, the data to be transferred is set as the input parameter of the interface update function, and based on the hosting of the interface update function, the interface update function is invoked by the callback function, so that the data to be transferred included in the input parameter of the interface update function is transferred to the WPF platform, and a specific transfer manner may be the communication method from the OSG interface to the WPF platform provided in any of the foregoing embodiments, which is not described herein again. Then, the WPF platform transmits the data to be transmitted to the Unity platform in a message format through a socket based on the built-in Unity executable program, and the specific transmission mode may be a communication method from the WPF platform to the Unity platform provided by any one of the above embodiments, which is not described herein again.
The following describes the communication device provided by the present invention, and the XX device described below and the communication method described above can be referred to correspondingly.
Based on any of the above embodiments, fig. 4 is one of the schematic structural diagrams of the communication device according to the embodiment of the present invention, and as shown in fig. 4, the device is deployed in the WPF platform, and includes a first parameter determining unit 410 and a function calling unit 420.
The first parameter determining unit 410 is configured to determine data to be transferred, and set the data to be transferred as an incoming parameter of a viewpoint setting function provided by the OSG interface;
the function calling unit 420 is configured to call a viewpoint setting function, and transmit data to be transferred included in an incoming parameter of the viewpoint setting function to the OSG interface, so that the OSG interface performs viewpoint setting based on the data to be transferred.
According to the device provided by the embodiment of the invention, the data to be transferred is set as the input parameters of the viewpoint setting function provided by the OSG interface, the viewpoint setting function is called, and the data to be transferred contained in the input parameters of the viewpoint setting function is transmitted to the OSG interface, so that the data transfer from the WPF platform to the OSG interface is realized, and the communication efficiency is high and the operation is stable.
Based on any one of the above embodiments, the apparatus further includes a first message transmission unit configured to:
based on the built-in Unity executable program, the data to be transferred is transmitted to the Unity platform in a message format through a socket.
According to the device provided by the embodiment of the invention, the data to be transmitted is packaged into the message, and the message is sent to the Unity through the socket, so that the communication efficiency between the WPF platform and the Unity platform is improved.
Based on any of the above embodiments, fig. 5 is a second schematic structural diagram of a communication device according to an embodiment of the present invention, as shown in fig. 5, where the device is deployed in an OSG interface, and includes: a function to be called receiving unit 510, a second parameter transferring unit 520 and a reverse function calling unit 530.
The function to be called receiving unit 510 is configured to receive a host of an interface update function that is input when the WPF platform calls a viewpoint setting function provided by an OSG interface;
the second parameter transferring unit 520 is configured to determine data to be transferred, and set the data to be transferred as an incoming parameter of an interface updating function;
the reverse function calling unit 530 is configured to call the interface update function through the callback function based on the hosting of the interface update function, and transmit data to be transferred included in the input parameters of the interface update function to the WPF platform, so that the WPF platform performs display processing on the data to be transferred.
According to the device provided by the embodiment of the invention, the data to be transferred is set as the input parameters of the interface updating function input by the WPF platform, and the interface updating function is called by the callback function, so that the data to be transferred contained in the input parameters of the interface updating function is transferred to the WPF platform, the data transfer from the OSG interface to the WPF platform is realized, and the communication efficiency is high and the operation is stable.
Based on any of the above embodiments, the backward call function unit 530 is specifically configured to:
converting the host of the interface updating function into a function pointer corresponding to the interface updating function;
and calling the interface updating function through the callback function based on the function pointer corresponding to the interface updating function.
Based on any one of the foregoing embodiments, a further embodiment of the present invention provides a communication device, where the device is disposed in a Unity platform, and the device includes a second message transmission unit configured to:
based on the socket embedded in the Unity program script, the data to be transferred are transmitted to the WPF platform in a message format.
According to the device provided by the embodiment of the invention, the data to be transmitted is packaged into the message, and the message is sent to the WPF platform through the socket, so that the communication efficiency between the WPF platform and the Unity platform is improved.
Based on any one of the above embodiments, another embodiment of the present invention provides a communication device, which includes an intermediate message transmission unit and an intermediate function call unit.
The middle message transmission unit is used for transmitting data to be transmitted to the WPF platform in a message format based on a socket embedded in a Unity program script of the Unity platform;
the intermediate function calling unit is used for calling the viewpoint setting function after the WPF platform sets the received data to be transferred as the input parameters of the viewpoint setting function provided by the OSG interface, and transmitting the data to be transferred contained in the input parameters of the viewpoint setting function to the OSG interface.
According to the device provided by the embodiment of the invention, the WPF is used as a medium, the Unity platform transmits the data to be transmitted to the WPF platform, and the WPF platform transmits the data to be transmitted to the OSG interface, so that the communication between the Unity platform and the OSG interface can be realized.
Based on any of the above embodiments, the apparatus further comprises: the device comprises an intermediate parameter input unit, an intermediate callback function calling unit and an intermediate message transmission unit.
The intermediate parameter input unit is used for determining data to be transmitted after the OSG interface receives the mandate of the interface update function which is input when the WPF platform calls the viewpoint setting function, and setting the data to be transmitted as the input parameter of the interface update function;
the intermediate callback function calling unit is used for the OSG interface to call the interface updating function through the callback function based on the hosting of the interface updating function, and the data to be transferred contained in the input parameters of the interface updating function are transmitted to the WPF platform;
the middle message transmission unit is used for transmitting the data to be transmitted to the Unity platform in a message format through a socket based on a built-in Unity executable program in the WPF platform.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the communication method provided by the above methods, the method comprising: determining data to be transferred, and setting the data to be transferred as an incoming parameter of a viewpoint setting function provided by an OSG interface; and calling the viewpoint setting function, and transmitting the data to be transmitted contained in the input parameters of the viewpoint setting function to an OSG interface so that the OSG interface can set the viewpoint based on the data to be transmitted.
When the program instructions are executed by a computer, the computer is further capable of executing the communication method provided by the methods, the method comprising: receiving the mandate of an interface update function which is transmitted when the WPF platform calls a viewpoint setting function provided by an OSG interface; determining data to be transferred, and setting the data to be transferred as an incoming parameter of the interface updating function; based on the hosting of the interface updating function, calling the interface updating function through a callback function, and transmitting the data to be transmitted contained in the input parameters of the interface updating function to a WPF platform so that the WPF platform can display the data to be transmitted.
When the program instructions are executed by a computer, the computer is further capable of executing the communication method provided by the methods, the method comprising: based on the socket embedded in the Unity program script, the data to be transferred are transmitted to the WPF platform in a message format.
When the program instructions are executed by a computer, the computer is further capable of executing the communication method provided by the methods, the method comprising: transmitting data to be transmitted to the WPF platform in a message format based on a socket embedded in a Unity program script of the Unity platform; and the WPF platform sets the received data to be transferred as the input parameters of the viewpoint setting function provided by the OSG interface, and then calls the viewpoint setting function to transmit the data to be transferred contained in the input parameters of the viewpoint setting function to the OSG interface.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which when executed by a processor is implemented to perform the above provided communication methods, the method comprising: determining data to be transferred, and setting the data to be transferred as an incoming parameter of a viewpoint setting function provided by an OSG interface; and calling the viewpoint setting function, and transmitting the data to be transmitted contained in the input parameters of the viewpoint setting function to an OSG interface so that the OSG interface can set the viewpoint based on the data to be transmitted.
The computer program, when executed by a processor, is also implemented to perform the communication methods provided above, the method comprising: receiving the mandate of an interface update function which is transmitted when the WPF platform calls a viewpoint setting function provided by an OSG interface; determining data to be transferred, and setting the data to be transferred as an incoming parameter of the interface updating function; based on the hosting of the interface updating function, calling the interface updating function through a callback function, and transmitting the data to be transmitted contained in the input parameters of the interface updating function to a WPF platform so that the WPF platform can display the data to be transmitted.
The computer program, when executed by a processor, is also implemented to perform the communication methods provided above, the method comprising: based on the socket embedded in the Unity program script, the data to be transferred are transmitted to the WPF platform in a message format.
The computer program, when executed by a processor, is also implemented to perform the communication methods provided above, the method comprising: transmitting data to be transmitted to the WPF platform in a message format based on a socket embedded in a Unity program script of the Unity platform; and the WPF platform sets the received data to be transferred as the input parameters of the viewpoint setting function provided by the OSG interface, and then calls the viewpoint setting function to transmit the data to be transferred contained in the input parameters of the viewpoint setting function to the OSG interface.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (5)

1. A communication method, wherein the method is applied to an OSG interface, and comprises:
receiving the mandate of an interface update function which is transmitted when the WPF platform calls a viewpoint setting function provided by an OSG interface;
determining data to be transferred, and setting the data to be transferred as an incoming parameter of the interface updating function;
based on the hosting of the interface updating function, calling the interface updating function through a callback function, and transmitting the data to be transmitted contained in the input parameters of the interface updating function to a WPF platform so that the WPF platform can display the data to be transmitted.
2. The communication method according to claim 1, wherein the calling the interface update function through a callback function based on the hosting of the interface update function specifically comprises:
converting the host of the interface updating function into a function pointer corresponding to the interface updating function;
and calling the interface updating function through a callback function based on the function pointer corresponding to the interface updating function.
3. A method of communication, comprising:
transmitting data to be transmitted to the WPF platform in a message format based on a socket embedded in a Unity program script of the Unity platform;
the WPF platform sets the received data to be transferred as the input parameters of the viewpoint setting function provided by the OSG interface, and then calls the viewpoint setting function to transmit the data to be transferred contained in the input parameters of the viewpoint setting function to the OSG interface;
further comprises:
after the OSG interface receives the mandate of the interface updating function transmitted when the WPF platform calls the viewpoint setting function, determining data to be transmitted, and setting the data to be transmitted as the transmitted parameters of the interface updating function;
the OSG interface calls the interface updating function through a callback function based on the hosting of the interface updating function, and the data to be transferred contained in the input parameters of the interface updating function are transmitted to the WPF platform;
the WPF platform transmits the data to be transmitted to the Unity platform in a message format through a socket based on a built-in Unity executable program.
4. A communication device, the device deployed in an OSG interface, comprising:
the function receiving unit to be called is used for receiving the mandate of the interface updating function which is transmitted when the WPF platform calls the viewpoint setting function provided by the OSG interface;
the second parameter transmission unit is used for determining data to be transmitted and setting the data to be transmitted as the input parameters of the interface updating function;
and the reverse call function unit is used for calling the interface updating function through a callback function based on the hosting of the interface updating function, and transmitting the data to be transmitted contained in the input parameters of the interface updating function to the WPF platform so as to enable the WPF platform to display and process the data to be transmitted.
5. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the communication method according to any one of claims 1 to 3.
CN202011315034.1A 2020-11-20 2020-11-20 Communication method, device and storage medium Active CN112486700B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011315034.1A CN112486700B (en) 2020-11-20 2020-11-20 Communication method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011315034.1A CN112486700B (en) 2020-11-20 2020-11-20 Communication method, device and storage medium

Publications (2)

Publication Number Publication Date
CN112486700A CN112486700A (en) 2021-03-12
CN112486700B true CN112486700B (en) 2023-06-02

Family

ID=74933090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011315034.1A Active CN112486700B (en) 2020-11-20 2020-11-20 Communication method, device and storage medium

Country Status (1)

Country Link
CN (1) CN112486700B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649084A (en) * 2016-09-14 2017-05-10 腾讯科技(深圳)有限公司 Function call information obtaining method and apparatus, and test device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060101412A1 (en) * 2004-11-10 2006-05-11 Microsoft Corporation Method to bridge between unmanaged code and managed code
CN103559375B (en) * 2013-11-22 2015-07-29 华中科技大学 The numerical simulation of scheduling engineering water correction and visual simulation system
CN104933758B (en) * 2015-05-20 2017-09-29 北京控制工程研究所 A kind of space camera three-dimensional imaging emulation mode based on OSG d engines
CN105184017B (en) * 2015-09-30 2018-01-02 成都赫尔墨斯科技股份有限公司 A kind of battlefield simulations system and method based on OpenSceneGraph
US10416836B2 (en) * 2016-07-11 2019-09-17 The Boeing Company Viewpoint navigation control for three-dimensional visualization using two-dimensional layouts

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649084A (en) * 2016-09-14 2017-05-10 腾讯科技(深圳)有限公司 Function call information obtaining method and apparatus, and test device

Also Published As

Publication number Publication date
CN112486700A (en) 2021-03-12

Similar Documents

Publication Publication Date Title
US10165042B2 (en) Methods and systems for conducting a remote desktop session via HTML that supports a 2D canvas and dynamic drawing
CN108681436A (en) Image quality parameter adjusting method, device, terminal and storage medium
EP2649533B1 (en) Methods and systems for facilitating a remote desktop session utilizing long polling
CN106846495B (en) Method and device for realizing augmented reality
CN107861754B (en) Data packaging method, data processing method, data packaging device, data processing device and electronic equipment
CN108880983B (en) Real-time voice processing method and device for virtual three-dimensional space
CN102664924B (en) Information processing method in remote assistance process and device
CN108776917B (en) Synchronous processing method and device for virtual three-dimensional space
WO2022105803A1 (en) Camera calling method and system, and electronic device
CN115546377B (en) Video fusion method and device, electronic equipment and storage medium
CN108765084B (en) Synchronous processing method and device for virtual three-dimensional space
CN111679811B (en) Web service construction method and device
CN114077508A (en) Remote image rendering method and device, electronic equipment and medium
KR20130065777A (en) Apparatus and method for sharing web contents using inspector script
CN106775616B (en) Distributed service system based on C + + and Java hybrid programming
CN115277666A (en) 5G-based equipment remote operation and maintenance method, device and storage medium
CN113778593B (en) Cloud desktop control method and device, electronic equipment, storage medium and program product
CN111818010B (en) Data transmission method and device, electronic equipment and storage medium
CN112486700B (en) Communication method, device and storage medium
CN108319420B (en) Picture loading method and device
CN112714341A (en) Information acquisition method, cloud set top box system, entity set top box and storage medium
CN115103204B (en) Method and device for realizing edge intelligent application supporting AI engine
CN115695383A (en) Screen sharing method and system, electronic device and android device
CN115437810A (en) Rendering task processing method, device, equipment and medium
CN114706518A (en) AI model reasoning method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant