1

我有一个可序列化的数据对象,我想通过 USB 作为数据包发送。它必须以 64 字节数据包的形式发送。在 CI 中会设置一个指向我的对象的指针并逐字节发送对象的大小。我在 java 中找不到“sizeof”功能?我有一个 64 字节的缓冲区,我已经可以用它发送一个数据包。如何将部分 fdata 加载到我的 USB 缓冲区中?

FileDataFormat fdata;

public class FileDataFormat implements Serializable {

    public static final Integer numofswitches = 8;  //use 1-7
    // set for 10 channels for future
    byte switchesEnabled = 0; //switchesEnabled


    String[][] switch_name = new String[numofswitches][20];  //auxLabels's
    int[] configurableMaxCurrentTenths = new int[numofswitches];                    //configurableMaxCurrentTenths
    byte softStartByte = 0;         //softStartByte
    byte delayedButtonPressEnable = 0;      //delayedButtonPressEnable
    byte[] delayedButtonPressTimeDelayTenths = new byte[numofswitches];         
    byte currentReadingSelectedChannels = 0;
    byte threshholdEnabled = 0; //threshholdEnabled
    byte[] triggerChannel = new byte[numofswitches]; //triggerChannel
    boolean[] expressionType = new boolean[numofswitches]; //expression type > or <
    float[] hysteresis = new float[numofswitches];
    float[] threshhold = new float[numofswitches];

    public FileDataFormat() {

    }
}
4

0 回答 0