def createNtTable(x): nRows = x.getInt('nRows') nColumns = x.getInt('nColumns') print 'Creating table with %d rows and %d columns' % (nRows, nColumns) ntTable = pvaccess.NtTable(nColumns, pvaccess.DOUBLE) labels = [] for j in range(0, nColumns): labels.append('Column%s' % j) column = [] for i in range(0, nRows): column.append(random.uniform(0, 1)) ntTable.setColumn(j, column) ntTable.setLabels(labels) ntTable.setDescriptor('Automatically created by RPC Server') return ntTable
def createNtTable(x): nRows = x.getInt('nRows') nColumns = x.getInt('nColumns') print('Creating table with %d rows and %d columns' % (nRows, nColumns)) ntTable = pvaccess.NtTable(nColumns, pvaccess.DOUBLE) labels = [] for j in range(0, nColumns): labels.append('Column%s' % j) column = [] for i in range(0, nRows): column.append(random.uniform(0, 1)) ntTable.setColumn(j, column) timeStamp = ntTable.getTimeStamp() timeStamp.setSecondsPastEpoch(123456) timeStamp.setNanoseconds(123) timeStamp.setUserTag(11) ntTable.setLabels(labels) ntTable.setDescriptor('Automatically created by RPC Server') return ntTable
def monitor(pvObject): ntTable = pvaccess.NtTable(pvObject) print("Full NT Table") print(ntTable) print("Column 0:") print(ntTable.getColumn(0))
#!/usr/bin/env python import pvaccess import random rpc = pvaccess.RpcClient('createNtTable') request = pvaccess.PvObject({'nRows' : pvaccess.INT, 'nColumns' : pvaccess.INT}) request.set({'nRows' : 10, 'nColumns' : 10}) print "Sending request for createNtTable:" print request print "Got response:" response = rpc.invoke(request) print response print "Converting to NtTable:" ntTable = pvaccess.NtTable(response) print ntTable print "Get column 3:" print ntTable.getColumn(3) print "Get descriptor:" print ntTable.getDescriptor()
def monitor(pvObject): ntTable = pvaccess.NtTable(pvObject) print "Full NT Table" print ntTable print "Column 0:" print ntTable.getColumn(0)
def table(x): ntTable = pvaccess.NtTable(x) col1 = ntTable.getColumn(1) print "server got column 1" r = pvaccess.PvString('abcd') return r