diff options
author | Michael 'Mickey' Lauer <mickey@vanille-media.de> | 2011-01-09 15:22:27 +0100 |
---|---|---|
committer | Michael 'Mickey' Lauer <mickey@vanille-media.de> | 2011-01-09 15:22:37 +0100 |
commit | 7d26af3b8e719c861e56c8e34795cbd98ba9a94f (patch) | |
tree | 6fa46d9b3cb010df3c9b12352960f84915977cdd /fsotdld/src | |
parent | 143177941f0119c765c10ba1f9e4542e6ee7568f (diff) | |
download | cornucopia-7d26af3b8e719c861e56c8e34795cbd98ba9a94f.tar.gz cornucopia-7d26af3b8e719c861e56c8e34795cbd98ba9a94f.tar.bz2 cornucopia-7d26af3b8e719c861e56c8e34795cbd98ba9a94f.zip |
fsotdld: start with contextmanager plugin
Diffstat (limited to 'fsotdld/src')
-rw-r--r-- | fsotdld/src/plugins/Makefile.am | 2 | ||||
-rw-r--r-- | fsotdld/src/plugins/contextmanager/Makefile.am (renamed from fsotdld/src/plugins/location/Makefile.am) | 14 | ||||
-rw-r--r-- | fsotdld/src/plugins/contextmanager/plugin.vala (renamed from fsotdld/src/plugins/location/plugin.vala) | 29 |
3 files changed, 25 insertions, 20 deletions
diff --git a/fsotdld/src/plugins/Makefile.am b/fsotdld/src/plugins/Makefile.am index 7ab83dc2..e315c25d 100644 --- a/fsotdld/src/plugins/Makefile.am +++ b/fsotdld/src/plugins/Makefile.am @@ -6,7 +6,7 @@ AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = \ alarm \ \ - location \ + contextmanager \ \ provider_gps \ provider_gps_nmea \ diff --git a/fsotdld/src/plugins/location/Makefile.am b/fsotdld/src/plugins/contextmanager/Makefile.am index b89a42f4..c9bbd206 100644 --- a/fsotdld/src/plugins/location/Makefile.am +++ b/fsotdld/src/plugins/contextmanager/Makefile.am @@ -29,15 +29,15 @@ VALAC_ARGS = \ # plugin # modlibexecdir = $(libdir)/cornucopia/modules/fsotdl -modlibexec_LTLIBRARIES = location.la -location_la_SOURCES = plugin.c -location_la_VALASOURCES = plugin.vala -$(location_la_SOURCES): $(location_la_VALASOURCES) +modlibexec_LTLIBRARIES = contextmanager.la +contextmanager_la_SOURCES = plugin.c +contextmanager_la_VALASOURCES = plugin.vala +$(contextmanager_la_SOURCES): $(contextmanager_la_VALASOURCES) $(VALAC) -C $(VALAC_ARGS) $^ touch $@ -location_la_LIBADD = $(progs_ldadd) -location_la_LDFLAGS = -no-undefined -module -avoid-version -location_la_LIBTOOLFLAGS = --tag=disable-static +contextmanager_la_LIBADD = $(progs_ldadd) +contextmanager_la_LDFLAGS = -no-undefined -module -avoid-version +contextmanager_la_LIBTOOLFLAGS = --tag=disable-static CLEANFILES = \ *.c \ diff --git a/fsotdld/src/plugins/location/plugin.vala b/fsotdld/src/plugins/contextmanager/plugin.vala index 6f2a6d31..bc5654d4 100644 --- a/fsotdld/src/plugins/location/plugin.vala +++ b/fsotdld/src/plugins/contextmanager/plugin.vala @@ -19,9 +19,9 @@ using GLib; -class Location.Service : FreeSmartphone.Location, FsoFramework.AbstractObject +class Context.Service : FreeSmartphone.Context.Manager, FsoFramework.AbstractObject { - internal const string MODULE_NAME = "fsotdl.location"; + internal const string MODULE_NAME = "fsotdl.contextmanager"; FsoFramework.Subsystem subsystem; private Gee.HashMap<string,FsoTdl.ILocationProvider> providers; @@ -36,7 +36,7 @@ class Location.Service : FreeSmartphone.Location, FsoFramework.AbstractObject public Service( FsoFramework.Subsystem subsystem ) { var tproviders = config.stringListValue( MODULE_NAME, "providers", {} ); - logger.debug( @"Will attempt to instantiate $(tproviders.length) location providers" ); + logger.debug( @"Will attempt to instantiate $(tproviders.length) contextmanager providers" ); foreach ( var typename in tproviders ) { @@ -58,7 +58,7 @@ class Location.Service : FreeSmartphone.Location, FsoFramework.AbstractObject status = new GLib.HashTable<string,Variant>( GLib.str_hash, GLib.str_equal ); - subsystem.registerObjectForService<FreeSmartphone.Location>( FsoFramework.Time.ServiceDBusName, FsoFramework.Time.LocationServicePath, this ); + subsystem.registerObjectForService<FreeSmartphone.Context.Manager>( FsoFramework.Context.ServiceDBusName, FsoFramework.Context.ManagerServicePath, this ); logger.info( "Ready." ); @@ -83,7 +83,7 @@ class Location.Service : FreeSmartphone.Location, FsoFramework.AbstractObject { logger.debug( @"Got location update from $(provider.get_type().name())" ); status = location; - this.location_update( status ); // DBUS SIGNAL + //this.location_update( status ); // DBUS SIGNAL } private void mergeStatusAndSendSignal( HashTable<string,Variant> location ) @@ -91,19 +91,24 @@ class Location.Service : FreeSmartphone.Location, FsoFramework.AbstractObject location.get_keys().foreach( (key) => { status.insert( (string)key, location.lookup( (string)key ) ); } ); - this.location_update( status ); // DBUS SIGNAL + //this.location_update( status ); // DBUS SIGNAL } // // org.freesmartphone.Location (DBus API) // - public async GLib.HashTable<string,GLib.Variant> get_location() throws FreeSmartphone.Error, DBusError, IOError + public async void subscribe_location_updates (FreeSmartphone.Context.LocationUpdateAccuracy desired_accuracy) throws FreeSmartphone.Error, GLib.DBusError, GLib.IOError { - return status; + // FIXME + } + + public async void unsubscribe_location_updates () throws FreeSmartphone.Error, GLib.DBusError, GLib.IOError + { + // FIXME } } -Location.Service service; +internal Context.Service service; /** * This function gets called on plugin initialization time. @@ -113,14 +118,14 @@ Location.Service service; **/ public static string fso_factory_function( FsoFramework.Subsystem subsystem ) throws Error { - service = new Location.Service( subsystem ); - return Location.Service.MODULE_NAME; + service = new Context.Service( subsystem ); + return Context.Service.MODULE_NAME; } [ModuleInit] public static void fso_register_function( TypeModule module ) { - FsoFramework.theLogger.debug( "fsotdl.location fso_register_function" ); + FsoFramework.theLogger.debug( "fsotdl.contextmanager fso_register_function" ); } /** |