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 {
* Return object name for file name
*=====================================*/
public static string? object_name(string file_name) {
autodetect();
try {
Controller c = Bus.get_proxy_sync(BusType.SESSION,"info.skorepa.DSerial1","/controller");
var path = c.get_path(file_name);
......@@ -68,6 +69,7 @@ public static string? object_name(string file_name) {
* List all available ports
*=====================================*/
public static string[] get_ports() {
autodetect();
try {
Properties c = Bus.get_proxy_sync(BusType.SESSION,"info.skorepa.DSerial1","/controller");
return c.get("info.skorepa.DSerial1.controller", "PortList").get_strv();
......@@ -156,13 +158,14 @@ public class SerialClient {
* Constructor
*=====================================*/
public SerialClient(string port_object) {
autodetect();
stdout.flush();
properties = new PropertiesAccessor(GLib.BusType.SESSION, "info.skorepa.DSerial1.port", port_object);
try {
stdout.flush();
methods = GLib.Bus.get_proxy_sync (GLib.BusType.SESSION, "info.skorepa.DSerial1", port_object);
} catch (IOError e) {}
methods.data_recieved.connect((t, msg) => {
this.data_recieved(msg);
});
......@@ -180,7 +183,7 @@ public class SerialClient {
public void reload_properties() {
properties.reload();
}
/*=====================================
* Flow Control
*=====================================*/
......@@ -204,7 +207,7 @@ public class SerialClient {
else if(value == FlowControl.software) properties.set_val("FlowControl", 3);
}
}
/*=====================================
* Port name
*=====================================*/
......@@ -231,7 +234,7 @@ public class SerialClient {
get {return (int32)properties.get_val("Baudrate");}
set {properties.set_val("Baudrate",value);}
}
/*=====================================
* Data bits
*=====================================*/
......@@ -292,7 +295,7 @@ public class SerialClient {
if(value == Parity.mark) properties.set_val("Parity",5);
}
}
/*=====================================
* Type
*=====================================*/
......@@ -303,7 +306,7 @@ public class SerialClient {
return ((EnumClass)typeof (Parity).class_ref()).get_value(this).value_nick;
}
}
public PortType porttype {
get {
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