Search in sources :

Example 1 with DciPushData

use of org.netxms.client.datacollection.DciPushData in project netxms by netxms.

the class NXCSession method pushDciData.

/**
 * Push data to server.
 *
 * @param data push data
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public void pushDciData(DciPushData[] data) throws IOException, NXCException {
    NXCPMessage msg = newMessage(NXCPCodes.CMD_PUSH_DCI_DATA);
    msg.setFieldInt32(NXCPCodes.VID_NUM_ITEMS, data.length);
    long varId = NXCPCodes.VID_PUSH_DCI_DATA_BASE;
    for (DciPushData d : data) {
        msg.setFieldInt32(varId++, (int) d.nodeId);
        if (d.nodeId == 0)
            msg.setField(varId++, d.nodeName);
        msg.setFieldInt32(varId++, (int) d.dciId);
        if (d.dciId == 0)
            msg.setField(varId++, d.dciName);
        msg.setField(varId++, d.value);
    }
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) DciPushData(org.netxms.client.datacollection.DciPushData)

Aggregations

NXCPMessage (org.netxms.base.NXCPMessage)1 DciPushData (org.netxms.client.datacollection.DciPushData)1