private SCONFIG_LIST sConfigList(SCONFIG[] sConfigs) { SCONFIG_LIST list = new SCONFIG_LIST(); list.numOfParams = new NativeLong(sConfigs.length); list.configPtr = (SCONFIG.ByReference) sConfigs[0]; list.write(); // System.out.printf("list:%n%s%n", list); return list; }
/** * Configures various PassThru parameters. * * @param channelId - handle to the open communications channel * @param items - values of multiple parameters can be set in an array of ConfigItem */ public void setConfig(int channelId, ConfigItem... items) { if (items.length == 0) return; SCONFIG[] sConfigs = sConfigs(items); SCONFIG_LIST list = sConfigList(sConfigs); NativeLong ioctlID = new NativeLong(); ioctlID.setValue(IOCtl.SET_CONFIG.getValue()); NativeLong ret = lib.PassThruIoctl(new NativeLong(channelId), ioctlID, list.getPointer(), null); if (ret.intValue() != Status.NOERROR.getValue()) handleError("PassThruIoctl (SET_CONFIG)", ret.intValue()); }
/** * Retrieve various PassThru configuration parameters. * * @param channelId - handle to the open communications channel * @param parameters - values of multiple parameters can be retrieved by setting an array of * integer parameter IDs * @return an array of <b>ConfigItem</b> * @see ConfigItem */ public ConfigItem[] getConfig(int channelId, int... parameters) { if (parameters.length == 0) return new ConfigItem[0]; SCONFIG[] sConfigs = sConfigs(parameters); SCONFIG_LIST input = sConfigList(sConfigs); NativeLong ioctlID = new NativeLong(); ioctlID.setValue(IOCtl.GET_CONFIG.getValue()); NativeLong ret = lib.PassThruIoctl(new NativeLong(channelId), ioctlID, input.getPointer(), null); if (ret.intValue() != Status.NOERROR.getValue()) handleError("PassThruIoctl (GET_CONFIG)", ret.intValue()); return configItems(input); }