El 26/09/14 09:48, Luca Bruno escribió:
On 26/09/2014 16:44, Matrix wrote:
? 2014/9/26 22:19, Luca Bruno ??:
On 26/09/2014 16:09, Matrix wrote:
Hi:
I'm try using Vala to write a GUI serialport tool with libserialport.
I have already have a demo with pure c implenmention.
I'm still working with write vapi file to this lib follow the tutorial
at https://wiki.gnome.org/Projects/Vala/LegacyBindings
but the c struct is init by this form:
enum sp_return sp_get_port_by_name(const char *portname, struct
sp_port **port_ptr);
how do i to write for such form ?
class Port {
[CCode (cname = "sp_get_port_by_name")]
static Return get_port_by_name (string portname, out Port);
}
Then:
Port port;
Port.get_port_by_name ("foo", out port);
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list
Thank you, Luca Bruno!
I follow your help, but have error....
there is my vapi file snippet:
/*************************************************
using GLib;
namespace SerialPort {
[CCode (cname = "int", cprefix = "SP_", has_type_id = "false")]
public enum Return {
OK,
ERR_ARG,
ERR_FAIL,
ERR_MEM,
ERR_SUPP
}
[CCode (cname = "struct sp_port", has_type_id = "false")]
public class Port {
[CCode (cname = "sp_get_port_by_name", has_type_id = "false")]
static Return get_port_by_name(string name, out Port);
}
}
/***************************************************
$ valac -C auto_test.vala --pkg libserialport
Compilation failed: 1 error(s), 0 warning(s)
libserialport.vapi:16.61-16.61: error: syntax error, expected identifier
static Return open_get_by_name(string name, out Port);
Of course, out Port port :)
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list
Sorry for the meddling but maybe this written in Vala for communication
with serial ports can be useful library.
https://github.com/edwinspire/libspire_serial
--
Axxis Hospital
Edwin De La Cruz
Desarrollador de software
Skype: edwinspire
Proyectos personales: https://github.com/edwinspire?tab=repositories
Quito - Ecuador
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list