-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event handling #1
Comments
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: 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: 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. |
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,
The text was updated successfully, but these errors were encountered: