Open mtp opened 3 years ago
Hello mtp,
Thanks for your question and for opening an issue.
Could you be a little bit more specific what you mean by "event"? May I ask, what you are trying to achieve?
The library currently does not support all SimConnect functions but I am working on a bigger update.
If by "event" you mean to "set data on a simobject", like the plane's altitude ("PLANE ALTITUDE"), you could have a look at the function handleTeleportMessage from GoPilot's main.go:
The function handleTeleportMessage calls SetSimObjectData of the struct SimMate.
If you don't want to use the SimMate, just roll your own:
Assuming you have an SimConnect instance named simConnect:
simConnect = simconnect.NewSimConnect()
Your function could look as follows:
func MySetSimObjectData(name, unit string, value float64) error {
defineID := simconnect.NewDefineID()
if err := simConnect.AddToDataDefinition(defineID, name, unit, simconnect.DataTypeFloat64); err != nil {
return err
}
buffer := [1]float64{value}
size := simconnect.DWord(unsafe.Sizeof(buffer))
return simConnect.SetDataOnSimObject(defineID, simconnect.ObjectIDUser, 0, 0, size, unsafe.Pointer(&buffer[0]))
}
And call it like this:
MySetSimObjectData("PLANE ALTITUDE", "feet", 7700)
Not sure if this is of any help though. Just let me know, I would be happy to help you find a solution.
Cheers!
Hello, thank for your answer. I wanted to send an event to othe sim using the SimConnect_TransmitClientEvent function.
Thanks for clarifying, mtp. The function SimConnect_TransmitClientEvent is not supported yet but it will be in the next update (which will be available soon). Sorry for the inconvenience!
Hello ! Thanks for this great library, brilliant! Do you know how can I handle sending event to the simulator ?
Best regards,