Replace named constructor Device.from_cache() with static method
Device.new_from_cache() to catch errors when loading from cache and
return null in such case.
Calling Socket.create_source() will generate a C call to
g_socket_datagram_based_create_source(), and that returns null for TCP
sockets. Use a helper Socket.create_socket_source() method to workaround
this problem..
GLib.Socket implements GLib.DatagramBased, hence calling
Socket.create_source() results in a C call to
g_socket_datagram_based_create_source() insted of
g_socket_create_source() as one my expect. The former works only for
datagram based sockets (as implemented in gio/gsocket.c), hence
Socket.create_source() for TCP socket will always return null. To
workaround this, export g_socket_create_source() as
Socket.create_socket_source() method.
The change is expected to be a part of vala 0.34 release.
Due to gio-2.0 VAPI changes Socket.create_source() does not return a
SocketSource anymore, but a standard GLib.Source instead. Make sure that
we cast to SocketSource.
VAPI is autogenerated based on GObject introspection. The problem is
that for gir to work a library must be run on the host, what obviously
brakes if cross compilation is used. As a workaround use the hand
generated VAPI and completely dump autogeneration.
This enables debugging with gdb. Without -g flag, the generated C code
does not have file/line set, hence gdb has no way of telling the Vala
code line the C code corresponds to.
Keep track of known device and dump their info to cache. This should
speed up reconnect after restarting mconnect. The rationale is that the
devices are likely to be connected to to the local network and use
DHCP and as such will most probably get the same address the next time
they appear. Hence, it should be ok to attemp connection the last know
IP address. If that fails, the discovery process will still take place.
Currently notifications shown so far are not tracked, thus often it
happens that multiple notifications regarding the same topic appear,
where only one should be shown. The change adds tracking of
notifications being shown within the Notification class.
Notifications cleared by user will be re-shown if device pushes them
again.
Whenever a mobile device wakes up, it will send an identity packet from
the same IP, using different 'tcpPort' in the message. This should
prevent device from being closed and reconnected to too frequently.