Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
apps
DSerial
Commits
e43309f0
Commit
e43309f0
authored
Aug 19, 2015
by
Isabella Skořepová
Browse files
Run autodetect automatically
parent
c7829100
Changes
1
Hide whitespace changes
Inline
Side-by-side
dserial-cli/src/dbus-serial-client.vala
View file @
e43309f0
...
...
@@ -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
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment