Commit e43309f0 authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

Run autodetect automatically

parent c7829100
...@@ -54,6 +54,7 @@ private interface Methods : GLib.Object { ...@@ -54,6 +54,7 @@ private interface Methods : GLib.Object {
* Return object name for file name * Return object name for file name
*=====================================*/ *=====================================*/
public static string? object_name(string file_name) { public static string? object_name(string file_name) {
autodetect();
try { try {
Controller c = Bus.get_proxy_sync(BusType.SESSION,"info.skorepa.DSerial1","/controller"); Controller c = Bus.get_proxy_sync(BusType.SESSION,"info.skorepa.DSerial1","/controller");
var path = c.get_path(file_name); var path = c.get_path(file_name);
...@@ -68,6 +69,7 @@ public static string? object_name(string file_name) { ...@@ -68,6 +69,7 @@ public static string? object_name(string file_name) {
* List all available ports * List all available ports
*=====================================*/ *=====================================*/
public static string[] get_ports() { public static string[] get_ports() {
autodetect();
try { try {
Properties c = Bus.get_proxy_sync(BusType.SESSION,"info.skorepa.DSerial1","/controller"); Properties c = Bus.get_proxy_sync(BusType.SESSION,"info.skorepa.DSerial1","/controller");
return c.get("info.skorepa.DSerial1.controller", "PortList").get_strv(); return c.get("info.skorepa.DSerial1.controller", "PortList").get_strv();
...@@ -156,13 +158,14 @@ public class SerialClient { ...@@ -156,13 +158,14 @@ public class SerialClient {
* Constructor * Constructor
*=====================================*/ *=====================================*/
public SerialClient(string port_object) { public SerialClient(string port_object) {
autodetect();
stdout.flush(); stdout.flush();
properties = new PropertiesAccessor(GLib.BusType.SESSION, "info.skorepa.DSerial1.port", port_object); properties = new PropertiesAccessor(GLib.BusType.SESSION, "info.skorepa.DSerial1.port", port_object);
try { try {
stdout.flush(); stdout.flush();
methods = GLib.Bus.get_proxy_sync (GLib.BusType.SESSION, "info.skorepa.DSerial1", port_object); methods = GLib.Bus.get_proxy_sync (GLib.BusType.SESSION, "info.skorepa.DSerial1", port_object);
} catch (IOError e) {} } catch (IOError e) {}
methods.data_recieved.connect((t, msg) => { methods.data_recieved.connect((t, msg) => {
this.data_recieved(msg); this.data_recieved(msg);
}); });
...@@ -180,7 +183,7 @@ public class SerialClient { ...@@ -180,7 +183,7 @@ public class SerialClient {
public void reload_properties() { public void reload_properties() {
properties.reload(); properties.reload();
} }
/*===================================== /*=====================================
* Flow Control * Flow Control
*=====================================*/ *=====================================*/
...@@ -204,7 +207,7 @@ public class SerialClient { ...@@ -204,7 +207,7 @@ public class SerialClient {
else if(value == FlowControl.software) properties.set_val("FlowControl", 3); else if(value == FlowControl.software) properties.set_val("FlowControl", 3);
} }
} }
/*===================================== /*=====================================
* Port name * Port name
*=====================================*/ *=====================================*/
...@@ -231,7 +234,7 @@ public class SerialClient { ...@@ -231,7 +234,7 @@ public class SerialClient {
get {return (int32)properties.get_val("Baudrate");} get {return (int32)properties.get_val("Baudrate");}
set {properties.set_val("Baudrate",value);} set {properties.set_val("Baudrate",value);}
} }
/*===================================== /*=====================================
* Data bits * Data bits
*=====================================*/ *=====================================*/
...@@ -292,7 +295,7 @@ public class SerialClient { ...@@ -292,7 +295,7 @@ public class SerialClient {
if(value == Parity.mark) properties.set_val("Parity",5); if(value == Parity.mark) properties.set_val("Parity",5);
} }
} }
/*===================================== /*=====================================
* Type * Type
*=====================================*/ *=====================================*/
...@@ -303,7 +306,7 @@ public class SerialClient { ...@@ -303,7 +306,7 @@ public class SerialClient {
return ((EnumClass)typeof (Parity).class_ref()).get_value(this).value_nick; return ((EnumClass)typeof (Parity).class_ref()).get_value(this).value_nick;
} }
} }
public PortType porttype { public PortType porttype {
get { get {
uint8 v = properties.get_val("Type").get_byte(); uint8 v = properties.get_val("Type").get_byte();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment