-
Notifications
You must be signed in to change notification settings - Fork 34
Filter fields for JBBPOut #36
Copy link
Copy link
Closed
Labels
Description
Hello
Thank you very much for your library. I just discovered it and it might help for my project. Up to now I was able to fully read the bytes from my device. Now I want to try to send data back to the device. So far everything works as designed.
Unfortunately the device has some packages containing a version when reading but we must not send them when writing to the device.
Example Bin annotated class:
public class Foo {
@Bin(order = 0, type = BinType.BYTE)
protected int startByte = 0x02;
@Bin(order = 1, type = BinType.BYTE)
protected int length;
@Bin(order = 2, type = BinType.BYTE)
protected int key;
@Bin(order = 3, type = BinType.BYTE) // must be removed when sending
protected int packageVersion;
@Bin(order = 4, type = BinType.BYTE)
// more fields here
}
When sending to the device I must remove the field packageVersion. Is there a way to have something like the following?
BeginBin().Bin(new Foo()).RemoveFieldByName("packageVersion").End();
BeginBin().Bin(new Foo(), filterDefinition).End();
Or at class level using Bin annotation:
@Bin(process = "read")
@Bin(process = "write")
@Bin(process = "always") // default
Is there already another way achieving this, or do I need to write a custom writer?
Best regards,
Tom
Reactions are currently unavailable