core: add helper to create QCDM serial ports from a file descriptor
Aids in unit testing
This commit is contained in:
@@ -196,6 +196,23 @@ mm_qcdm_serial_port_new (const char *name, MMPortType ptype)
|
|||||||
NULL));
|
NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MMQcdmSerialPort *
|
||||||
|
mm_qcdm_serial_port_new_fd (int fd, MMPortType ptype)
|
||||||
|
{
|
||||||
|
MMQcdmSerialPort *port;
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
name = g_strdup_printf ("port%d", fd);
|
||||||
|
port = MM_QCDM_SERIAL_PORT (g_object_new (MM_TYPE_QCDM_SERIAL_PORT,
|
||||||
|
MM_PORT_DEVICE, name,
|
||||||
|
MM_PORT_SUBSYS, MM_PORT_SUBSYS_TTY,
|
||||||
|
MM_PORT_TYPE, ptype,
|
||||||
|
MM_SERIAL_PORT_FD, fd,
|
||||||
|
NULL));
|
||||||
|
g_free (name);
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mm_qcdm_serial_port_init (MMQcdmSerialPort *self)
|
mm_qcdm_serial_port_init (MMQcdmSerialPort *self)
|
||||||
{
|
{
|
||||||
|
@@ -50,6 +50,8 @@ GType mm_qcdm_serial_port_get_type (void);
|
|||||||
|
|
||||||
MMQcdmSerialPort *mm_qcdm_serial_port_new (const char *name, MMPortType ptype);
|
MMQcdmSerialPort *mm_qcdm_serial_port_new (const char *name, MMPortType ptype);
|
||||||
|
|
||||||
|
MMQcdmSerialPort *mm_qcdm_serial_port_new_fd (int fd, MMPortType ptype);
|
||||||
|
|
||||||
void mm_qcdm_serial_port_queue_command (MMQcdmSerialPort *self,
|
void mm_qcdm_serial_port_queue_command (MMQcdmSerialPort *self,
|
||||||
GByteArray *command,
|
GByteArray *command,
|
||||||
guint32 timeout_seconds,
|
guint32 timeout_seconds,
|
||||||
|
Reference in New Issue
Block a user