Helper Functions
    *************************************************************'''

    def convert_rf_to_if(self,rf_freq):
        #Convert freq based on RF/IF of Analog Tuner
        
        if self.rfinfo.if_center_freq > 0:
            ifoffset = rf_freq - self.rfinfo.rf_center_freq
            if_freq =self.rfinfo.if_center_freq+ifoffset
        else:
            if_freq = rf_freq 

        self._log.debug("Converted RF Freq of %s to IF Freq %s based on Input RF of %s, IF of %s, and spectral inversion %s" %(rf_freq,if_freq,self.rfinfo.rf_center_freq,self.rfinfo.if_center_freq,self.rfinfo.spectrum_inverted))
        return float(if_freq)
    
    #Start with smallest possible and see if that can satisfy request.
    # Sending 0 for don't care should pass because we are looking for requested to be less than available
    def findBestBWSR(self,requestedBW,requestedSR):
        self._log.debug("findBestBWSR")
        for bw,sr,decimation in self.AVAILABLE_BW_SR:
            self._log.debug("findBestBWSR. Requested: " + str(requestedBW) +" "+ str(requestedSR) + " evaluating: " + str(bw)+" "+ str(sr))
            if bw>= requestedBW and sr>=requestedSR:
                return (bw,sr,decimation)
        return (False,False,False)
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(RX_Digitizer_Sim_i)

            
            if packet.dataBuffer is None:
                return NOOP
                
            outData = range(len(packet.dataBuffer))
            for i in range(len(packet.dataBuffer)):
                if self.increaseAmplitude:
                    outData[i] = float(packet.dataBuffer[i]) * self.amplitude
                else:
                    outData[i] = float(packet.dataBuffer[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if packet.sriChanged:
                self.port_dataFloat_out.pushSRI(packet.SRI);

            self.port_dataFloat_out.pushPacket(outData, packet.T, packet.EOS, packet.streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP

  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(PropertyFilteringDev_i)

            if packet.dataBuffer is None:
                return NOOP
                
            outData = range(len(packet.dataBuffer))
            for i in range(len(packet.dataBuffer)):
                if self.increaseAmplitude:
                    outData[i] = float(packet.dataBuffer[i]) * self.amplitude
                else:
                    outData[i] = float(packet.dataBuffer[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if packet.sriChanged:
                self.port_dataFloat_out.pushSRI(packet.SRI);

            self.port_dataFloat_out.pushPacket(outData, packet.T, packet.EOS, packet.streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP

  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    time.sleep(15)
    start_device(SlowLaunchDevice_i)

Exemplo n.º 4
0
        self.lastScanStrategy = "%s = %s" % (allocation_id, str(scan_strategy))

    '''
    *************************************************************
    Functions servicing the RFInfo port(s)
    - port_name is the port over which the call was received
    *************************************************************'''
    def get_rf_flow_id(self,port_name):
        return ""

    def set_rf_flow_id(self,port_name, _id):
        pass

    def get_rfinfo_pkt(self,port_name):
        _antennainfo=FRONTEND.AntennaInfo('','','','')
        _freqrange=FRONTEND.FreqRange(0,0,[])
        _feedinfo=FRONTEND.FeedInfo('','',_freqrange)
        _sensorinfo=FRONTEND.SensorInfo('','','',_antennainfo,_feedinfo)
        _rfcapabilities=FRONTEND.RFCapabilities(_freqrange,_freqrange)
        _rfinfopkt=FRONTEND.RFInfoPkt('',0.0,0.0,0.0,False,_sensorinfo,[],_rfcapabilities,[])
        return _rfinfopkt

    def set_rfinfo_pkt(self,port_name, pkt):
        pass
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(scanner_i)

Exemplo n.º 5
0
            data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed = self.port_dataShort_in.getPacket()
            
            if data == None:
                return NOOP
                
            outData = range(len(data))
            for i in range(len(data)):
                if self.increaseAmplitude:
                    outData[i] = float(data[i]) * self.amplitude
                else:
                    outData[i] = float(data[i])
                
            // NOTE: You must make at least one valid pushSRI call
            if sriChanged:
                self.port_dataFloat_out.pushSRI(sri);
            }
            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP
        
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(issue_111_i)
Exemplo n.º 6
0
    def setTunerEnable(self,allocation_id, enable):
        idx = self.getTunerMapping(allocation_id)
        if idx < 0: raise FRONTEND.FrontendException("Invalid allocation id")
        if allocation_id != self.getControlAllocationId(idx):
            raise FRONTEND.FrontendException(("ID "+str(allocation_id)+" does not have authorization to modify the tuner"))
        # set hardware to new value. Raise an exception if it's not possible
        self.frontend_tuner_status[idx].enabled = enable

    def getTunerEnable(self,allocation_id):
        idx = self.getTunerMapping(allocation_id)
        if idx < 0: raise FRONTEND.FrontendException("Invalid allocation id")
        return self.frontend_tuner_status[idx].enabled

    def get_rf_flow_id(self,port_name):
        return "none"

    def set_rf_flow_id(self,port_name, id):
        pass

    def get_rfinfo_pkt(self,port_name):
        return frontend.RFInfoPkt()

    def set_rfinfo_pkt(self,port_name, pkt):
        pass
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(analogTuner_i)

Exemplo n.º 7
0
            # NOTE: You must make at least one valid pushSRI call
            if sriChanged:
                self.port_dataFloat_out.pushSRI(sri);

            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP

    def allocate_simple_prop(self,value):
        self._log.info("Calling allocate_simple_prop passing value " + str(value))
        return True
    
    def allocate_prop_with_spaces(self,value):
        self._log.info("Calling allocate_prop_with_spaces " + str(value))
        return True

    def allocate_prop__with_colons(self,value):
        self._log.info("Calling allocate_prop__with_colons " + str(value))
        return True
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(ticket_1502_i)

      if self._props["memCapacity"] < value:
          return False
      self._props["memCapacity"] = self._props["memCapacity"] - value
      return True

    def allocate_BogoMipsCapacity(self, value):
      if self._props["BogoMipsCapacity"] < value:
          return False
      self._props["BogoMipsCapacity"] = self._props["BogoMipsCapacity"] - value
      return True

    def deallocate_memCapacity(self, value):
      self._props["memCapacity"] = self._props["memCapacity"] + value

    def deallocate_BogoMipsCapacity(self, value):
      self._props["BogoMipsCapacity"] = self._props["BogoMipsCapacity"] + value

    def updateUsageState(self):
      # Update usage state
      if self._props["memCapacity"] == 0 and self._props["BogoMipsCapacity"] == 0:
          self._usageState = CF.Device.BUSY
      elif self._props["memCapacity"] == 100000000 and self._props["BogoMipsCapacity"] == 100000000:
          self._usageState = CF.Device.IDLE
      else:
          self._usageState = CF.Device.ACTIVE

if __name__ == "__main__":
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(PortDevice_impl)
  def deallocate_memCapacity(self, value):
    self._props["memCapacity"] = self._props["memCapacity"] + value

  def deallocate_BogoMipsCapacity(self, value):
    self._props["BogoMipsCapacity"] = self._props["BogoMipsCapacity"] + value

  def updateUsageState(self):
    # Update usage state
    self._usageState = CF.Device.BUSY
    

  class SomeStruct(object):
      field1 = simple_property(id_="item1",
                                type_="string",
                                defvalue="value1")
      field2 = simple_property(id_="item2",
                                type_="long",
                                defvalue=100)
      field3 = simple_property(id_="item3",
                                type_="double",
                                defvalue=3.14156)

  struct = struct_property(id_="DCE:ffe634c9-096d-425b-86cc-df1cce50612f", 
                           name="struct_test", 
                           structdef=SomeStruct)

if __name__ == "__main__":
    logging.getLogger().setLevel(logging.DEBUG)
    logging.debug("Starting Device")
    start_device(BasicAlwaysBusyDevice)
                                     mode="readonly",
                                     kinds=("allocation",))

  def allocate_BogoMipsCapacity (self, value):
    if self.BogoMipsCapacity < value:
      return False
    self.BogoMipsCapacity -= value
    return True

  def deallocate_BogoMipsCapacity (self, value):
    self.BogoMipsCapacity += value

  def updateUsageState (self):
    # Update usage state
    if self.BogoMipsCapacity == 0:
      self._usageState = CF.Device.BUSY
    elif self.BogoMipsCapacity == 100000000:
      self._usageState = CF.Device.IDLE
    else:
      self._usageState = CF.Device.ACTIVE

  def execute (self, *args):
    if self.crashEnabled:
      os.kill(os.getpid(), signal.SIGKILL)
    return ExecutableDevice.execute(self, *args)

if __name__ == "__main__":
    logging.getLogger().setLevel(logging.DEBUG)
    logging.debug("Starting Device")
    start_device(CrashableExecutableDevice)
Exemplo n.º 11
0
      if self.long_capacity <= other.long_capacity:
        return False
      if self.float_capacity <= other.float_capacity:
        return False
      return True

    def __iadd__(self, other):
      self.long_capacity += other.long_capacity
      self.float_capacity += other.float_capacity
      return self

    def __isub__(self, other):
      self.long_capacity -= other.long_capacity
      self.float_capacity -= other.float_capacity
      return self

  allocStruct = struct_property(id_="DCE:001fad60-b4b3-4ed2-94cb-40e1d956bf4f",
                                 name="allocStruct",
                                 configurationkind=("configure", "allocation"),
                                 structdef=AllocStruct)

  structseq = structseq_property(id_="DCE:e836f007-5821-4671-b05a-e0ff5147fe86",
                                 name="structseq_test",
                                 structdef=SomeStruct,
                                 defvalue=[])

if __name__ == "__main__":
    logging.getLogger().setLevel(logging.DEBUG)
    logging.debug("Starting Device")
    start_device(BadRelease)
# Demonstrate the attribute MixIn
class BasicChildDevice(CF__POA.Device, Device, PropertyAttributeMixIn):

    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
        Device.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams, PROPERTIES)
      
    def _allocateCapacity(self, propname, value):
        if propname == "someCapacity":
            self.prop_someCapacity = self.props_someCapacity - value
            if self.prop_someCapacity < 0:
                return False
            return True
        else:
            return False

    def _deallocateCapacity(self, propname, value):
        if propname == "someCapacity":
            self.prop_someCapacity = self.prop_someCapacity + value

    def updateUsageState(self):
        if self.prop_someCapacity == 0 and self.prop_someCapacity == 0:
            self._usageState = CF.Device.BUSY
        elif self.prop_someCapacity == 100000000 and self.prop_someCapacity == 100000000: 
            self._usageState = CF.Device.IDLE
        else:
            self._usageState = CF.Device.ACTIVE

if __name__ == "__main__":
    start_device(BasicChildDevice)
            packet = self.port_dataShort_in.getPacket()
            
            if packet.dataBuffer is None:
                return NOOP
                
            outData = range(len(packet.dataBuffer))
            for i in range(len(packet.dataBuffer)):
                if self.increaseAmplitude:
                    outData[i] = float(packet.dataBuffer[i]) * self.amplitude
                else:
                    outData[i] = float(packet.dataBuffer[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if packet.sriChanged:
                self.port_dataFloat_out.pushSRI(packet.SRI)

            self.port_dataFloat_out.pushPacket(outData, packet.T, packet.EOS, packet.streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP


if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(dev_props_bad_numbers_i)
            data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed = self.port_dataShort_in.getPacket()
            
            if data == None:
                return NOOP
                
            outData = range(len(data))
            for i in range(len(data)):
                if self.increaseAmplitude:
                    outData[i] = float(data[i]) * self.amplitude
                else:
                    outData[i] = float(data[i])
                
            // NOTE: You must make at least one valid pushSRI call
            if sriChanged:
                self.port_dataFloat_out.pushSRI(sri);
            }
            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP
        
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(test_collocation_device_i)
Exemplo n.º 15
0
            
            if data == None:
                return NOOP
                
            outData = range(len(data))
            for i in range(len(data)):
                if self.increaseAmplitude:
                    outData[i] = float(data[i]) * self.amplitude
                else:
                    outData[i] = float(data[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if sriChanged:
                self.port_dataFloat_out.pushSRI(sri);

            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP
        
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(bad_init_device_i)

            data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed = self.port_dataShort_in.getPacket()
            
            if data == None:
                return NOOP
                
            outData = range(len(data))
            for i in range(len(data)):
                if self.increaseAmplitude:
                    outData[i] = float(data[i]) * self.amplitude
                else:
                    outData[i] = float(data[i])
                
            // NOTE: You must make at least one valid pushSRI call
            if sriChanged:
                self.port_dataFloat_out.pushSRI(sri);
            }
            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP
        
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(test_collocation_device_i)
Exemplo n.º 17
0
    def initialize(self):
        DeviceStub_base.initialize(self)
        self.sampleSRIPushed = False

    def updateUsageState(self):
        return NOOP

    def process(self):
        packet = self.port_dataFloat_in.getPacket()
        if packet.dataBuffer is None:
            # Slow pushes of small sample data
            if not self.sampleSRIPushed:
                self.sampleSRIPushed = True
                self.port_dataFloat_out.pushSRI(bulkio.sri.create("DeviceStub_sample"))
            outData = [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ]
            self.port_dataFloat_out.pushPacket(outData, bulkio.timestamp.now(), False, "DeviceStub_sample")
            return NOOP

        # Feed through existing data
        if packet.sriChanged:
            self.port_dataFloat_out.pushSRI(packet.SRI)
        self.port_dataFloat_out.pushPacket(packet.dataBuffer, packet.T, packet.EOS, packet.streamID)
        return NORMAL

  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(DeviceStub_i)

            if tmp_val < 0:
                raise Exception('Cannot deallocate more than %d' %
                                self.__MAX_BOGOMIPS)
            
            self.allocated_bog = tmp_val
            self._props[self.__bog_id] = self.allocated_bog
            return True
        except Exception, e:
            print "\tGot an error while deallocationg BogoMips: %s" % str(e)
            return False
                        
    def updateUsageState(self):
        """
        This is called automatically after allocateCapacity or deallocateCapacity are called.
        Your implementation should determine the current state of the device:
           self._usageState = CF.Device.IDLE   # not in use
           self._usageState = CF.Device.ACTIVE # in use, with capacity remaining for allocation
           self._usageState = CF.Device.BUSY   # in use, with no capacity remaining for allocation
        """
        pass
            
###########################################                    
# program execution
###########################################
if __name__ == "__main__":
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(BasicTestDevice_python_impl1)


Exemplo n.º 19
0
            outData = range(len(packet.dataBuffer))
            for i in range(len(packet.dataBuffer)):
                if self.increaseAmplitude:
                    outData[i] = float(packet.dataBuffer[i]) * self.amplitude
                else:
                    outData[i] = float(packet.dataBuffer[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if packet.sriChanged:
                self.port_dataFloat_out.pushSRI(packet.SRI);

            self.port_dataFloat_out.pushPacket(outData, packet.T, packet.EOS, packet.streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() DEBUG example log message")
        self._log.info("process()  INFO example log message")
        self._log.error("process() ERROR example log message") 
        self._log.trace("process() TRACE example log message")
        self._log.warn("process()  WARN example log message")   
        return NOOP

  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(python_dev_i)

Exemplo n.º 20
0
    def get_mcastnicEgressFree(self):
        return self.mcastnicEgressCapacity
    mcastnicEgressFree = rebind(GPP_base.mcastnicEgressFree, fget=get_mcastnicEgressFree)

    def get_loadTotal(self):
        return self.processor_cores * self.loadCapacityPerCore
    loadTotal = rebind(GPP_base.loadTotal, fget=get_loadTotal)

    def get_loadAverage(self):
        loadavg = self._loadavg()
        result = GPP_base.LoadAverage()
        result.onemin = loadavg[0]
        result.fivemin = loadavg[1]
        result.fifteenmin = loadavg[2]
        return result
    loadAverage = rebind(GPP_base.loadAverage, fget=get_loadAverage)

    def get_loadFree(self):
        return self.loadCapacity
    loadFree = rebind(GPP_base.loadFree, fget=get_loadFree)

    def get_hostName(self):
        return socket.gethostname()
    hostName = rebind(GPP_base.hostName, fget=get_hostName)

###########################################
# program execution
###########################################
if __name__ == "__main__":
    start_device(GPP)
Exemplo n.º 21
0
            data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed = self.port_dataShort_in.getPacket()
            
            if data == None:
                return NOOP
                
            outData = range(len(data))
            for i in range(len(data)):
                if self.increaseAmplitude:
                    outData[i] = float(data[i]) * self.amplitude
                else:
                    outData[i] = float(data[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if sriChanged:
                self.port_dataFloat_out.pushSRI(sri);

            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP
        
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(ticket_cf_939_dev_i)
Exemplo n.º 22
0
    def get_rfinfo_pkt(self,port_name):
        return frontend.RFInfoPkt()

    def set_rfinfo_pkt(self,port_name, pkt):
        pass

    '''
    *************************************************************
    Functions servicing the GPS port(s)
    - port_name is the port over which the call was received
    *************************************************************'''
    #TODO: Implement GPS readback from radio
    def get_gps_info(self,port_name):
        return frontend.GPSInfo()

    def set_gps_info(self,port_name, gps_info):
        pass

    def get_gps_time_pos(self,port_name):
        return frontend.GpsTimePos()

    def set_gps_time_pos(self,port_name, gps_time_pos):
        pass
      
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(NDRFEI_i)

Exemplo n.º 23
0
            
            if data == None:
                return NOOP
                
            outData = range(len(data))
            for i in range(len(data)):
                if self.increaseAmplitude:
                    outData[i] = float(data[i]) * self.amplitude
                else:
                    outData[i] = float(data[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if sriChanged:
                self.port_dataFloat_out.pushSRI(sri);

            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP

  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(alloc_test_i)

Exemplo n.º 24
0
            
            if packet.dataBuffer is None:
                return NOOP
                
            outData = range(len(packet.dataBuffer))
            for i in range(len(packet.dataBuffer)):
                if self.increaseAmplitude:
                    outData[i] = float(packet.dataBuffer[i]) * self.amplitude
                else:
                    outData[i] = float(packet.dataBuffer[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if packet.sriChanged:
                self.port_dataFloat_out.pushSRI(packet.SRI);

            self.port_dataFloat_out.pushPacket(outData, packet.T, packet.EOS, packet.streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP

  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(nocmdline_dev_i)

Exemplo n.º 25
0
            data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed = self.port_dataShort_in.getPacket()
            
            if data == None:
                return NOOP
                
            outData = range(len(data))
            for i in range(len(data)):
                if self.increaseAmplitude:
                    outData[i] = float(data[i]) * self.amplitude
                else:
                    outData[i] = float(data[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if sriChanged:
                self.port_dataFloat_out.pushSRI(sri);

            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP
        
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(SADUsesDevice_i)
      if self.long_capacity <= other.long_capacity:
        return False
      if self.float_capacity <= other.float_capacity:
        return False
      return True

    def __iadd__(self, other):
      self.long_capacity += other.long_capacity
      self.float_capacity += other.float_capacity
      return self

    def __isub__(self, other):
      self.long_capacity -= other.long_capacity
      self.float_capacity -= other.float_capacity
      return self

  allocStruct = struct_property(id_="DCE:001fad60-b4b3-4ed2-94cb-40e1d956bf4f",
                                 name="allocStruct",
                                 configurationkind=("configure", "allocation"),
                                 structdef=AllocStruct)

  structseq = structseq_property(id_="DCE:e836f007-5821-4671-b05a-e0ff5147fe86",
                                 name="structseq_test",
                                 structdef=SomeStruct,
                                 defvalue=[])

if __name__ == "__main__":
    logging.getLogger().setLevel(logging.DEBUG)
    logging.debug("Starting Device")
    start_device(BadReleaseBefore)
            data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed = self.port_dataShort_in.getPacket()
            
            if data == None:
                return NOOP
                
            outData = range(len(data))
            for i in range(len(data)):
                if self.increaseAmplitude:
                    outData[i] = float(data[i]) * self.amplitude
                else:
                    outData[i] = float(data[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if sriChanged:
                self.port_dataFloat_out.pushSRI(sri);

            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP
        
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(ExampleExecutableDevice01_i)
Exemplo n.º 28
0
        """
        streamID = "TCP port {0}".format(self.port_num)
        data, samplePeriod = self._server.getDataAndSampleTime()
        returnCode = NOOP
        
        if (0 < len(data)):
            returnCode = NORMAL
            
            utcNow = None
            gpsInfo = self.port_GPS_uses._get_gps_info()
            if (None != gpsInfo):
                utcNow = gpsInfo.timestamp        
            else:
                utcNow = bulkio.timestamp.now()
            
            if (self._sendSRI):
                sri = bulkio.sri.create(streamID)
                sri.xdelta = samplePeriod
                self.port_dataFloat_out.pushSRI(sri)
                self._sendSRI = False

            self.port_dataFloat_out.pushPacket(data, utcNow, 
                                               False, streamID)
            
        return returnCode        
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(simple_tcp_i)
Exemplo n.º 29
0
            
            if packet.dataBuffer is None:
                return NOOP
                
            outData = range(len(packet.dataBuffer))
            for i in range(len(packet.dataBuffer)):
                if self.increaseAmplitude:
                    outData[i] = float(packet.dataBuffer[i]) * self.amplitude
                else:
                    outData[i] = float(packet.dataBuffer[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if packet.sriChanged:
                self.port_dataFloat_out.pushSRI(packet.SRI);

            self.port_dataFloat_out.pushPacket(outData, packet.T, packet.EOS, packet.streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP

  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.INFO)
    logging.debug("Starting Device")
    start_device(cmdline_dev_i)

            #   - A provides (input) port of type BULKIO.dataShort called dataShort_in
            #   - A uses (output) port of type BULKIO.dataFloat called dataFloat_out
            # The mapping between the port and the class if found in the component
            # base class.
            # This example also makes use of the following Properties:
            #   - A float value called amplitude
            #   - A boolean called increaseAmplitude
            
            data, T, EOS, streamID, sri = self.port_dataShort_in.getPacket()
            
            if data == None:
                return NOOP
                
            outData = range(len(data))
            for i in range(len(data)):
                if self.increaseAmplitude:
                    outData[i] = float(data[i]) * self.amplitude
                else:
                    outData[i] = float(data[i])
                
            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            
        """
        self.updateUsageState()
        return NOOP
  
if __name__ == '__main__':
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(PythonExecDev_python_impl1_i)
Exemplo n.º 31
0
            data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed = self.port_dataShort_in.getPacket()
            
            if data == None:
                return NOOP
                
            outData = range(len(data))
            for i in range(len(data)):
                if self.increaseAmplitude:
                    outData[i] = float(data[i]) * self.amplitude
                else:
                    outData[i] = float(data[i])
                
            # NOTE: You must make at least one valid pushSRI call
            if sriChanged:
                self.port_dataFloat_out.pushSRI(sri);

            self.port_dataFloat_out.pushPacket(outData, T, EOS, streamID)
            return NORMAL
            
        """

        # TODO fill in your code here
        self._log.debug("process() example log message")
        return NOOP


if __name__ == "__main__":
    logging.getLogger().setLevel(logging.WARN)
    logging.debug("Starting Device")
    start_device(MatchingDevice_i)
    def __iadd__(self, other):
      self.long_capacity += other.long_capacity
      self.float_capacity += other.float_capacity
      return self

    def __isub__(self, other):
      self.long_capacity -= other.long_capacity
      self.float_capacity -= other.float_capacity
      return self

  allocStruct = struct_property(id_="DCE:001fad60-b4b3-4ed2-94cb-40e1d956bf4f",
                                 name="allocStruct",
                                 configurationkind=("configure", "allocation"),
                                 structdef=AllocStruct)

  structseq = structseq_property(id_="DCE:e836f007-5821-4671-b05a-e0ff5147fe86",
                                 name="structseq_test",
                                 structdef=SomeStruct,
                                 defvalue=[])

  hex_props = simpleseq_property(id_="hex_props",
                                 name="hex_props",
                                 type_='short',
                                 defvalue=(0x01, 0x02))

if __name__ == "__main__":
    logging.getLogger().setLevel(logging.DEBUG)
    logging.debug("Starting Device")
    start_device(BasicTestDevice)
Exemplo n.º 33
0
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see http://www.gnu.org/licenses/.
#

from ossie.cf import CF, CF__POA
from ossie.device import ExecutableDevice, AggregateDevice, start_device
import os, sys, stat
from omniORB import URI, any
import commands, copy, time, signal, pprint, subprocess
import logging
import signal
import shutil
from BasicTestDeviceProps import PROPERTIES


class BasicTestDevice(CF__POA.AggregateExecutableDevice, ExecutableDevice,
                      AggregateDevice):
    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                                  compositeDevice, execparams, PROPERTIES)
        AggregateDevice.__init__(self)


if __name__ == "__main__":
    logging.getLogger().setLevel(logging.DEBUG)
    logging.debug("Starting Device")
    start_device(BasicTestDevice)