def __init__(self, Name, Function, Global=False, RawMode=False):
      Message.__init__ (self, Name, Attach=True, Global=Global, \
 RawMode=RawMode)
      self.Name = Name
      self.Global = Global
      self.RawMode = RawMode
      self.Function = Function
    def __init__ (self, Name, Function, Global=False, RawMode=False):
        Message.__init__ (self, Name, Attach=True, Global=Global, \
			RawMode=RawMode)
	self.Name = Name
	self.Global = Global
	self.RawMode = RawMode
	self.Function = Function
    def __init__ (self, Name, Function, Global=False, RawMode=False, Start=False):
        Message.__init__ (self)
	self.Name = Name
	self.Global = Global
	self.RawMode = RawMode
	self.Function = Function
	self.s = Message (self.Name, Attach=True, Global=self.Global, \
			RawMode=self.RawMode)
	if Start: self.Start()
    def __init__ (self, Name, Attr=None, Ocb = None, Verbose=0, Flags=0, Chid=-1, RawMode=True):
        """ 
	Resmgr class - __init__ method.
	Creates the necessary library and other library connections.
	Initialises the Attriibutes structure. 
	imports Message  
	Initialises the resmgr. 
	
	@param Name:  The name to be registered (e.g. /dev/gps)
	@param Attr:  An optional/preconfigured Attributes instance. 
	@param Ocb:   The ocb structure. 
	@param Verbose: Sets the verbosity level
	@param Flags: Resmgr_attach flags. See QNX docs.
	@param Chid:  ChannelId.
	"""

	Message.__init__(self)
    
	self._iofunc_stat = self.lib.iofunc_stat
	    
	# use the atribute provided (may be larger) or the default. 
	if Attr == None: Attr = iofunc_attr_t ()
	self.Attr = Attr

	# use the OCB provided or the default.
	if Ocb == None: Ocb = iofunc_ocb_t
	self.Ocb = Ocb
	self.Ocb.offset = 0	

	# import and link C helper functions from resmgrfns
	from resmgrfns import (Init, Run, AddIo, AddConnect, AddPulse)

	self.Init         = Init	# init the resmgr
	self.Run          = Run		# block and handle the messages
	self._AddIo       = AddIo	# add an io function
	self._AddConnect  = AddConnect	# add a connect function
	self.AddPulse	   = AddPulse

	# for use in message passing/replying to the client. 

	self.lib.ThreadCtl (1, 0)	# allow permissions! 
	self.Verbose    = Verbose
	self.DeviceName = Name 
	self.Flags      = Flags	
	self.Chid       = Chid
	self.io_write_t = io_write_t

	# from resmgrfns. Initialise the whole Resmgr. attach etc
	# flags before=1(default) , after=2, dir=0x100

	self.Init (self, self.DeviceName, Attr=self.Attr, Ocb=self.Ocb,
		Verbose=self.Verbose, Flags=self.Flags,
		Chid=self.Chid)

	self.Attr.mtime = self.Attr.ctime = self.Attr.atime = int ( time.time())

	print "Resmgr '%s' Initialised." % self.DeviceName 
    def __init__ (self, Name, Global=False, RawMode=False, WaitFor=True):
	Message.__init__ (self)
	self.RawMode = RawMode
	self.Global  = Global

	if WaitFor:
	    WaitforAttach (Name, Global)

        self.coid = self.name_open (Name, Global)
	self.Name = Name
    def __init__(self, Name, Global=False, RawMode=False, WaitFor=True):
        Message.__init__(self)
        self.RawMode = RawMode
        self.Global = Global

        if WaitFor:
            WaitforAttach(Name, Global)

        self.coid = self.name_open(Name, Global)
        self.Name = Name
 def __init__(self,
              Name,
              Function,
              Global=False,
              RawMode=False,
              Start=False):
     Message.__init__(self)
     self.Name = Name
     self.Global = Global
     self.RawMode = RawMode
     self.Function = Function
     self.s = Message (self.Name, Attach=True, Global=self.Global, \
       RawMode=self.RawMode)
     if Start: self.Start()
Esempio n. 8
0
    def __init__(self,
                 Name,
                 Attr=None,
                 Ocb=None,
                 Verbose=0,
                 Flags=0,
                 Chid=-1,
                 RawMode=True):
        """ 
	Resmgr class - __init__ method.
	Creates the necessary library and other library connections.
	Initialises the Attriibutes structure. 
	imports Message  
	Initialises the resmgr. 
	
	@param Name:  The name to be registered (e.g. /dev/gps)
	@param Attr:  An optional/preconfigured Attributes instance. 
	@param Ocb:   The ocb structure. 
	@param Verbose: Sets the verbosity level
	@param Flags: Resmgr_attach flags. See QNX docs.
	@param Chid:  ChannelId.
	"""

        Message.__init__(self)

        self._iofunc_stat = self.lib.iofunc_stat

        # use the atribute provided (may be larger) or the default.
        if Attr == None: Attr = iofunc_attr_t()
        self.Attr = Attr

        # use the OCB provided or the default.
        if Ocb == None: Ocb = iofunc_ocb_t
        self.Ocb = Ocb
        self.Ocb.offset = 0

        # import and link C helper functions from resmgrfns
        from resmgrfns import (Init, Run, AddIo, AddConnect, AddPulse)

        self.Init = Init  # init the resmgr
        self.Run = Run  # block and handle the messages
        self._AddIo = AddIo  # add an io function
        self._AddConnect = AddConnect  # add a connect function
        self.AddPulse = AddPulse

        # for use in message passing/replying to the client.

        self.lib.ThreadCtl(1, 0)  # allow permissions!
        self.Verbose = Verbose
        self.DeviceName = Name
        self.Flags = Flags
        self.Chid = Chid
        self.io_write_t = io_write_t

        # from resmgrfns. Initialise the whole Resmgr. attach etc
        # flags before=1(default) , after=2, dir=0x100

        self.Init(self,
                  self.DeviceName,
                  Attr=self.Attr,
                  Ocb=self.Ocb,
                  Verbose=self.Verbose,
                  Flags=self.Flags,
                  Chid=self.Chid)

        self.Attr.mtime = self.Attr.ctime = self.Attr.atime = int(time.time())

        if self.Verbose: print "Resmgr '%s' Initialised." % self.DeviceName