def __clientRPC(self, function, params, conn_time=1.0, resp_time=5.0): """ internal library for pvAccess channel RPC. conn_time: waiting time for connection, 1.0 by default; resp_time: waiting time for response, 5.0 by default """ alarm = Alarm() timeStamp = TimeStamp() ntnv = NTNameValue(function, params) # now do issue + wait channelRPC = ChannelRPC(self.channelname) channelRPC.issueConnect() if not channelRPC.waitConnect(conn_time): #print channelRPC.getMessage() raise Exception(channelRPC.getMessage()) channelRPC.issueRequest(ntnv.getNTNameValue(), False) result = channelRPC.waitResponse(resp_time) if result is None: #print channelRPC.getMessage() raise Exception(channelRPC.getMessage()) if function in ["retrieveSnapshot", "getLiveMachine", "saveSnapshot"]: result = NTMultiChannel(result) elif function in [ "retrieveServiceEvents", "retrieveServiceConfigs", "retrieveServiceConfigProps" ]: result = NTTable(result) elif function == "updateSnapshotEvent": result = NTScalar(result) result.getAlarm(alarm) result.getTimeStamp(timeStamp) return result
def __clientRPC(self, function, params, conn_time=1.0, resp_time=5.0): """ internal library for pvAccess channel RPC. conn_time: waiting time for connection, 1.0 by default; resp_time: waiting time for response, 5.0 by default """ alarm = Alarm() timeStamp = TimeStamp() ntnv = NTNameValue(function, params) # now do issue + wait channelRPC = ChannelRPC(self.channelname) channelRPC.issueConnect() if not channelRPC.waitConnect(conn_time): #print channelRPC.getMessage() raise Exception(channelRPC.getMessage()) channelRPC.issueRequest(ntnv.getNTNameValue(), False) result = channelRPC.waitResponse(resp_time) if result is None: #print channelRPC.getMessage() raise Exception(channelRPC.getMessage()) if function in ["retrieveSnapshot", "getLiveMachine", "saveSnapshot"]: result = NTMultiChannel(result) elif function in ["retrieveServiceEvents", "retrieveServiceConfigs", "retrieveServiceConfigProps"]: result = NTTable(result) elif function == "updateSnapshotEvent": result = NTScalar(result) result.getAlarm(alarm) result.getTimeStamp(timeStamp) return result
def __clientRPC(self, function, params): """ internal library for pvAccess channel RPC. """ alarm = Alarm() timeStamp = TimeStamp() ntnv = NTNameValue(function,params) # now do issue + wait channelRPC = ChannelRPC(self.channelname,"record[process=true]field()") channelRPC.issueConnect() if not channelRPC.waitConnect(1.0) : print channelRPC.getMessage() raise Exception(channelRPC.getMessage()) channelRPC.issueRequest(ntnv.getNTNameValue(),False) result = channelRPC.waitRequest() if(result==None) : print channelRPC.getMessage() raise Exception(channelRPC.getMessage()) nttable = NTTable(result) nttable.getAlarm(alarm.getAlarmPy()) nttable.getTimeStamp(timeStamp.getTimeStampPy()) return nttable