public void setI2CRegisters(Map<String, Integer> activeRegister) { rpcContainer.clear(); cbcNames.clear(); registerValues.clear(); registerValues = activeRegister; for (String _cbcName : getActiveCBCs()) { cbcNames.put(_cbcName, registerValues); } rpcContainer.add(cbcNames); rpcMessage myparams = new rpcMessage(); myparams.setMethod("setI2CRegisterValues"); myparams.setParams(rpcContainer); service_.rpcService( myparams, new MethodCallback<rpcResponse>() { @Override public void onFailure(Method method, Throwable exception) { // TODO Auto-generated method stub } @Override public void onSuccess(Method method, rpcResponse response) { getI2CValues(); } }); }
public void getI2CValues() { rpcContainer.clear(); registerValues.clear(); cbcNames.clear(); registerValues.put(null, null); for (String _cbcName : getActiveCBCs()) { cbcNames.put(_cbcName, registerValues); } rpcContainer.add(cbcNames); rpcMessage myparams = new rpcMessage(); myparams.setMethod("I2CRegisterValues"); myparams.setParams(rpcContainer); service_.rpcService( myparams, new MethodCallback<rpcResponse>() { @Override public void onFailure(Method method, Throwable exception) { // TODO Auto-generated method stub Window.alert(exception.getMessage().toString()); } @Override public void onSuccess(Method method, rpcResponse response) { Map<String, Integer> regValues = new HashMap<String, Integer>(); regValues = response .getResult() .get( cbcList_.getItemText( cbcList_ .getSelectedIndex())); // edits values from selected item on list for (String regValueNames : regValues.keySet()) { TextBox test = i2cValueEntries.get(regValueNames); test.setEnabled(true); String hexValue = Integer.toHexString(regValues.get(regValueNames)); if (hexValue.length() == 1) { test.setText("0x0" + hexValue); } else { test.setText("0x" + hexValue); } } } }); }