From 25bc2d11234f353858da5259d8c14627c677a8bc Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 17 May 2015 14:56:37 +0200 Subject: update poll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/bus.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/bus.py') diff --git a/src/bus.py b/src/bus.py index ad7d3a5..dcc6e80 100644 --- a/src/bus.py +++ b/src/bus.py @@ -184,7 +184,7 @@ class Bus: raise self.__oserror() - def poll_start(self, flags : int = 0): + def poll_start(self): ''' Announce that the thread is listening on the bus. This is required so the will does not miss any @@ -192,13 +192,9 @@ class Bus: not calling this function will cause the bus the misbehave, is `Bus.poll` is written to expect this function to have been called. - - @param flags:int `Bus.NOWAIT` if the bus should fail with `os.errno.EAGAIN` - if there isn't already a message available on the bus when - `Bus.poll` is called ''' from native_bus import bus_poll_start_wrapped - (r, e) = bus_poll_start_wrapped(self.bus, flags) + (r, e) = bus_poll_start_wrapped(self.bus) if r == -1: raise self.__oserror(e) @@ -215,7 +211,7 @@ class Bus: raise self.__oserror(e) - def poll(self) -> bytes: + def poll(self, flags : int = 0) -> bytes: ''' Wait for a message to be broadcasted on the bus. The caller should make a copy of the received message, @@ -224,11 +220,13 @@ class Bus: started, the caller of this function should then either call `Bus.poll` again or `Bus.poll_stop`. - @return :bytes The received message - NB! The received message will not be decoded from UTF-8 + @param flags:int `Bus.NOWAIT` if the bus should fail with `os.errno.EAGAIN` + if there isn't already a message available on the bus + @return :bytes The received message + NB! The received message will not be decoded from UTF-8 ''' from native_bus import bus_poll_wrapped - (message, e) = bus_poll_wrapped(self.bus) + (message, e) = bus_poll_wrapped(self.bus, flags) if message is None: raise self.__oserror(e) return message -- cgit v1.2.3-70-g09d2