CELIX-230: Added some comment for the command service. Added some (char *) casts


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/4234d9bb
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/4234d9bb
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/4234d9bb

Branch: refs/heads/master
Commit: 4234d9bb0898819a56f27ce51f34e7693f079e43
Parents: 8104a77
Author: Pepijn Noltes <pepijnnol...@gmail.com>
Authored: Tue Nov 3 10:05:57 2015 +0100
Committer: Pepijn Noltes <pepijnnol...@gmail.com>
Committed: Tue Nov 3 10:05:57 2015 +0100

----------------------------------------------------------------------
 .../calculator_shell/private/src/calculator_shell_activator.c | 6 +++---
 shell/public/include/command.h                                | 7 +++++++
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/4234d9bb/remote_services/examples/calculator_shell/private/src/calculator_shell_activator.c
----------------------------------------------------------------------
diff --git 
a/remote_services/examples/calculator_shell/private/src/calculator_shell_activator.c
 
b/remote_services/examples/calculator_shell/private/src/calculator_shell_activator.c
index 275a67d..ddbe842 100644
--- 
a/remote_services/examples/calculator_shell/private/src/calculator_shell_activator.c
+++ 
b/remote_services/examples/calculator_shell/private/src/calculator_shell_activator.c
@@ -83,7 +83,7 @@ celix_status_t bundleActivator_start(void * userData, 
bundle_context_pt context)
        activator->addCmdSrv->executeCommand = (void *)addCommand_execute;
        properties_pt props = properties_create();
        properties_set(props, OSGI_SHELL_COMMAND_NAME, "add");
-       bundleContext_registerService(context, OSGI_SHELL_COMMAND_SERVICE_NAME, 
activator->addCmdSrv, props, &activator->addCommand);
+       bundleContext_registerService(context, (char 
*)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->addCmdSrv, props, 
&activator->addCommand);
 
 
        activator->sqrtCmdSrv = calloc(1, sizeof(*activator->sqrtCmdSrv));
@@ -91,14 +91,14 @@ celix_status_t bundleActivator_start(void * userData, 
bundle_context_pt context)
        activator->sqrtCmdSrv->executeCommand = (void *)sqrtCommand_execute;
        props = properties_create();
        properties_set(props, OSGI_SHELL_COMMAND_NAME, "sqrt");
-       bundleContext_registerService(context, OSGI_SHELL_COMMAND_SERVICE_NAME, 
activator->sqrtCmdSrv, props, &activator->sqrtCommand);
+       bundleContext_registerService(context, (char 
*)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->sqrtCmdSrv, props, 
&activator->sqrtCommand);
 
        activator->subCmdSrv = calloc(1, sizeof(*activator->subCmdSrv));
        activator->subCmdSrv->handle = context;
        activator->subCmdSrv->executeCommand = (void *)subCommand_execute;
        props = properties_create();
        properties_set(props, OSGI_SHELL_COMMAND_NAME, "sub");
-       bundleContext_registerService(context, OSGI_SHELL_COMMAND_SERVICE_NAME, 
activator->subCmdSrv, props, &activator->subCommand);
+       bundleContext_registerService(context, (char 
*)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->subCmdSrv, props, 
&activator->subCommand);
 
        return status;
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/4234d9bb/shell/public/include/command.h
----------------------------------------------------------------------
diff --git a/shell/public/include/command.h b/shell/public/include/command.h
index 97872c7..9abe789 100644
--- a/shell/public/include/command.h
+++ b/shell/public/include/command.h
@@ -38,6 +38,13 @@ static const char * const OSGI_SHELL_COMMAND_SERVICE_NAME = 
"commandService";
 
 typedef struct commandService * command_service_pt;
 
+/**
+ * The command service can be used to register additional shell commands.
+ * The service should be register with the following properties:
+ *  - command.name: mandatory, name of the command e.g. 'lb'
+ *  - command.usage: optional, string describing how tu use the commmand e.g. 
'lb [-l | -s | -u]'
+ *  - command.descrription: optional, string describing the command e.g. 'list 
bundles.'
+ */
 struct commandService {
        void *handle;
        celix_status_t (*executeCommand)(void *handle, char * commandLine, FILE 
*outStream, FILE *errorStream);

Reply via email to