/** * NOTE: alignment (8) is done externally * @param dataTypeValue * @param dataCount * @param value * @return calculated (non-aligned) payload size. */ // TODO size could be extracted from DBR type obejct // TODO converting TYPE -> short and now short -> TYPE public static int calculatePayloadSize(short dataTypeValue, int dataCount, Object value) { DBRType dataType = DBRType.forValue(dataTypeValue); if (dataType == null) throw new IllegalArgumentException("Invalid data type value: " + dataTypeValue); int additionalPayload = PAYLOAD_SIZE[dataTypeValue]; return calculateValuePayloadSize(dataCount, value, dataType) + additionalPayload; }
/** * @see com.cosylab.epics.caj.impl.TransportClient#transportResponsive(com.cosylab.epics.caj.impl.Transport) */ public synchronized void transportResponsive(Transport transport) { //System.err.println("CHANNEL transportResponsive"); if (connectionState == ConnectionState.DISCONNECTED) { /* // responsive again, stop searching context.getChannelSearchManager().unregisterChannel(this); */ updateSubscriptions(); // reconnect using existing IDs, data connectionCompleted(serverChannelID, (short)type.getValue(), elementCount); } }
DBRType dataType = DBRType.forValue(dataTypeValue); if (dataType == null) throw new IllegalArgumentException("Invalid data type."); if (dataTypeValue < DBR_String.TYPE.getValue()) return null; else if (dataTypeValue < DBR_STS_String.TYPE.getValue()) return getValueDBR(inDBR, dataType, dataCount, dataPayloadBuffer); else if (dataTypeValue < DBR_TIME_String.TYPE.getValue()) return getStatusDBR(inDBR, dataType, dataCount, dataPayloadBuffer); else if (dataTypeValue < DBR_GR_Short.TYPE.getValue() - 1) return getTimeDBR(inDBR, dataType, dataCount, dataPayloadBuffer); else if (dataTypeValue < DBR_CTRL_Short.TYPE.getValue() - 1) return getGraphicsDBR(inDBR, dataType, dataCount, dataPayloadBuffer); else if (dataTypeValue < DBR_PutAckT.TYPE.getValue()) return getControlDBR(inDBR, dataType, dataCount, dataPayloadBuffer);
DBRType dataType = DBRType.forValue(dataTypeValue); if (dataType == null) throw new IllegalArgumentException("Invalid data type value: " + dataTypeValue); if (dataType.isSTS()) else if (dataType.isLABELS()) if (dataType.isTIME() && !dataType.isGR() && !(dataTypeValue == 21 || dataTypeValue == 28)) // not GR_STRING, CTRL_STRING if (dataType.isGR()) if (dataType.isPRECISION()) if (dataType.isSHORT()) else if (dataType.isFLOAT()) else if (dataType.isBYTE()) else if (dataType.isINT()) else if (dataType.isDOUBLE()) if (dataType.isCTRL()) if (dataType.isSHORT())
channel.put(toBytes(newValue.toString())); } else { if (channel.getFieldType().isBYTE() && channel.getElementCount() > 1) { log.warning("You are writing the String " + newValue + " to BYTE channel " + getChannelName() + ": use {\"longString\":true} for support"); channel.put(toBytes(newValue.toString()));
protected void initializePut() { PVString pvString = pvRequest.getSubField(PVString.class,"record._options.block"); if(pvString!=null) { String value = pvString.get(); if(value.equals("true")) block = true; } if(v3ChannelStructure.createPVStructure(pvRequest,true)==null) { elementCount = 1; channelPutRequester.channelPutConnect(createChannelStructureStatus,this,null); destroy(); return; } elementCount = jcaChannel.getElementCount(); DBRType nativeDBRType = v3ChannelStructure.getNativeDBRType(); if(nativeDBRType.isENUM() && elementCount != 1) { channelPutRequester.channelPutConnect(statusCreate.createStatus(StatusType.ERROR, "array of ENUM not supported", null),this,null); destroy(); return; } channelPutRequester.channelPutConnect(okStatus,this, v3ChannelStructure.getPVStructure().getStructure()); } /* (non-Javadoc)
@Override public synchronized Map<String, Object> getProperties() { Map<String, Object> properties = new HashMap<String, Object>(); if (channel != null) { properties.put("CA Channel name", channel.getName()); properties.put("CA Connection state", channel.getConnectionState().getName()); if (channel.getConnectionState() == Channel.ConnectionState.CONNECTED) { properties.put("CA Hostname", channel.getHostName()); properties.put("CA Channel type", channel.getFieldType().getName()); properties.put("CA Element count", channel.getElementCount()); properties.put("CA Read access", channel.getReadAccess()); properties.put("CA Write access", channel.getWriteAccess()); } properties.put("isLongString", isLongString()); properties.put("isPutCallback", isPutCallback()); properties.put("Connected", isConnected()); properties.put("Write Connected", isWriteConnected()); properties.put("Connection payload", getConnectionPayload()); properties.put("Last message payload", getLastMessagePayload()); } return properties; }
DBRType dataType = DBRType.forValue(dataTypeValue); if (dataType == null) throw new IllegalArgumentException("Invalid data type value: " + dataTypeValue); if (dataType.isSTS()) else if (dataType.isLABELS()) if (dataType.isTIME() && !dataType.isGR() && !(dataTypeValue == 21 || dataTypeValue == 28)) // not GR_STRING, CTRL_STRING if (dataType.isGR()) if (dataType.isPRECISION()) if (dataType.isSHORT()) else if (dataType.isFLOAT()) else if (dataType.isBYTE()) else if (dataType.isINT()) else if (dataType.isDOUBLE()) if (dataType.isCTRL()) if (dataType.isSHORT())
channel.put(toBytes(newValue.toString())); } else { if (channel.getFieldType().isBYTE() && channel.getElementCount() > 1) { log.warning("You are writing the String " + newValue + " to BYTE channel " + getChannelName() + ": use {\"longString\":true} for support"); channel.put(toBytes(newValue.toString()));
DBRType dataType = DBRType.forValue(dataTypeValue); if (dataType == null) throw new IllegalArgumentException("Invalid data type."); if (dataTypeValue < DBR_String.TYPE.getValue()) return null; else if (dataTypeValue < DBR_STS_String.TYPE.getValue()) return getValueDBR(inDBR, dataType, dataCount, dataPayloadBuffer); else if (dataTypeValue < DBR_TIME_String.TYPE.getValue()) return getStatusDBR(inDBR, dataType, dataCount, dataPayloadBuffer); else if (dataTypeValue < DBR_GR_Short.TYPE.getValue() - 1) return getTimeDBR(inDBR, dataType, dataCount, dataPayloadBuffer); else if (dataTypeValue < DBR_CTRL_Short.TYPE.getValue() - 1) return getGraphicsDBR(inDBR, dataType, dataCount, dataPayloadBuffer); else if (dataTypeValue < DBR_PutAckT.TYPE.getValue()) return getControlDBR(inDBR, dataType, dataCount, dataPayloadBuffer);
@Override public synchronized Map<String, Object> getProperties() { Map<String, Object> properties = new HashMap<String, Object>(); if (channel != null) { properties.put("CA Channel name", channel.getName()); properties.put("CA Connection state", channel.getConnectionState().getName()); if (channel.getConnectionState() == Channel.ConnectionState.CONNECTED) { properties.put("CA Hostname", channel.getHostName()); properties.put("CA Channel type", channel.getFieldType().getName()); properties.put("CA Element count", channel.getElementCount()); properties.put("CA Read access", channel.getReadAccess()); properties.put("CA Write access", channel.getWriteAccess()); } properties.put("isLongString", isLongString()); properties.put("isPutCallback", isPutCallback()); properties.put("Connected", isConnected()); properties.put("Write Connected", isWriteConnected()); properties.put("Connection payload", getConnectionPayload()); properties.put("Last message payload", getLastMessagePayload()); } return properties; }
channel.put(toBytes(newValue.toString()), listener); } else { if (channel.getFieldType().isBYTE() && channel.getElementCount() > 1) { log.warning("You are writing the String " + newValue + " to BYTE channel " + getChannelName() + ": use {\"longString\":true} for support"); channel.put(toBytes(newValue.toString()), listener);
/** * @see com.cosylab.epics.caj.impl.TransportClient#transportResponsive(com.cosylab.epics.caj.impl.Transport) */ public synchronized void transportResponsive(Transport transport) { //System.err.println("CHANNEL transportResponsive"); if (connectionState == ConnectionState.DISCONNECTED) { /* // responsive again, stop searching context.getChannelSearchManager().unregisterChannel(this); */ updateSubscriptions(); // reconnect using existing IDs, data connectionCompleted(serverChannelID, (short)type.getValue(), elementCount); } }
/** * NOTE: alignment (8) is done externally * @param dataTypeValue * @param dataCount * @param value * @return calculated (non-aligned) payload size. */ // TODO size could be extracted from DBR type obejct // TODO converting TYPE -> short and now short -> TYPE public static int calculatePayloadSize(short dataTypeValue, int dataCount, Object value) { DBRType dataType = DBRType.forValue(dataTypeValue); if (dataType == null) throw new IllegalArgumentException("Invalid data type value: " + dataTypeValue); int additionalPayload = PAYLOAD_SIZE[dataTypeValue]; return calculateValuePayloadSize(dataCount, value, dataType) + additionalPayload; }
private static boolean dbrTypeMatch(DBRType aType, DBRType anotherType) { if (aType.getClass() == null && anotherType.getClass() != null) { return false; } if (aType.getClass() != null && anotherType.getClass() == null) { return false; } return aType.isBYTE() && anotherType.isBYTE() || aType.isDOUBLE() && anotherType.isDOUBLE() || aType.isENUM() && anotherType.isENUM() || aType.isFLOAT() && anotherType.isFLOAT() || aType.isINT() && anotherType.isINT() || aType.isSHORT() && anotherType.isSHORT() || aType.isSTRING() && anotherType.isSTRING(); }