serial: add mm_serial_port_is_open()

This commit is contained in:
Dan Williams
2010-01-31 12:04:53 -08:00
parent 7659208037
commit ba9634ae4f
2 changed files with 11 additions and 0 deletions

View File

@@ -852,6 +852,15 @@ mm_serial_port_open (MMSerialPort *self, GError **error)
return TRUE;
}
gboolean
mm_serial_port_is_open (MMSerialPort *self)
{
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (MM_IS_SERIAL_PORT (self), FALSE);
return (MM_SERIAL_PORT_GET_PRIVATE (self)->fd >= 0);
}
void
mm_serial_port_close (MMSerialPort *self)
{

View File

@@ -79,6 +79,8 @@ void mm_serial_port_set_response_parser (MMSerialPort *self,
gpointer user_data,
GDestroyNotify notify);
gboolean mm_serial_port_is_open (MMSerialPort *self);
gboolean mm_serial_port_open (MMSerialPort *self,
GError **error);