Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds full FFB packet parsing into python dicts using callback functions and the missing FFB related functions from the vJoy sdk.
Solves issue #17
A helper class for receiving and translating C style structs to python dicts using integrated vJoy functions was added in sdk.py.
If preferred it may be possible to split some functionality into sdk and vjoydevice as it did require some higher level processing.
Using different or the same callbacks per device is possible. The callbacks are stored by rID and called based on the source.
Parsed FFB data is passed as a python dict to the callback allowing the use of
if "ctrl" in packet
for example to check if the packet is a control packet.Info: This has not yet been extensively used yet but all reports have been tested and verified and should contain valid data.
Note: _wrapper.py was not touched. It seems like this file is not in use anymore. Possibly delete the whole file?
The duplicated SetBtn function was also deleted.
Example usage:
For testing "fedit.exe" or the iracing wheelcheck tool can be used.
The sdk callback returns parsed structs and a packet type (previously directly as a dict but that might be too restrictive).
A dict of the packet can be generated using a static helper function
ffb_packet_to_dict(packet,packettype)
which can then directly update an effect dict if a block index is present and returns the dict and an effect block index.An effect block index of 0 means that this packet does not address a specific effect and must be treated as a global control report.
Note: vjoy only seems to return block index 1 for all effects even if multiple effects are in use. This is problematic as it would only work well with a single effect.
Type is one of the newly added "PT_" constants.
Valid packet names generated by the
ffb_packet_to_dict
to function are:ctrl
: device control report. Enable or disable actuators.effect
: Set effect report. Changes effect parameters.ramp
: Ramp report. Changes parameters of a ramp effect.effop
: Effect operation. Enables or disables a specific effect.period
: Period effect report. Changes periodic effects.cond
: Conditional effect report. Changes conditional effects.envelope
: Envelope report.neweff
: New effect report. Called when a new effect is created at EffectBlockIndex.const
: Constant force report. Changes magnitude of constant force effects.gain
: Changes total gain of device.blkfree
: Block free report. Deletes an effect from EffectBlockIndex.