diff --git a/src/command.c b/src/command.c index 5c35971..0572ec9 100644 --- a/src/command.c +++ b/src/command.c @@ -34,6 +34,7 @@ struct _GSMCommand unsigned int timeout; GSMError error; GSMCommandCallback callback; + void * data; GSMMode mode; }; @@ -55,6 +56,7 @@ GSMCommand * gsm_command_new(char const * command) gsmc->timeout = 2000; gsmc->error = GSM_ERROR_UNKNOWN; gsmc->callback = NULL; + gsmc->data = NULL; gsmc->mode = GSM_MODE_COMMAND; /* check errors */ if(gsmc->command == NULL) @@ -92,6 +94,13 @@ char const * gsm_command_get_command(GSMCommand * gsmc) } +/* gsm_command_get_data */ +void * gsm_command_get_data(GSMCommand * gsmc) +{ + return gsmc->data; +} + + /* gsm_command_get_error */ GSMError gsm_command_get_error(GSMCommand * gsmc) { @@ -128,6 +137,13 @@ void gsm_command_set_callback(GSMCommand * gsmc, } +/* gsm_command_set_data */ +void gsm_command_set_data(GSMCommand * gsmc, void * data) +{ + gsmc->data = data; +} + + /* gsm_command_set_error */ void gsm_command_set_error(GSMCommand * gsmc, GSMError error) { diff --git a/src/command.h b/src/command.h index 87cb557..fd4a2d9 100644 --- a/src/command.h +++ b/src/command.h @@ -31,12 +31,14 @@ void gsm_command_delete(GSMCommand * gsmc); /* accessors */ GSMCommandCallback gsm_command_get_callback(GSMCommand * gsmc); char const * gsm_command_get_command(GSMCommand * gsmc); +void * gsm_command_get_data(GSMCommand * gsmc); GSMError gsm_command_get_error(GSMCommand * gsmc); GSMMode gsm_command_get_mode(GSMCommand * gsmc); GSMPriority gsm_command_get_priority(GSMCommand * gsmc); unsigned int gsm_command_get_timeout(GSMCommand * gsmc); void gsm_command_set_callback(GSMCommand * gsmc, GSMCommandCallback callback); +void gsm_command_set_data(GSMCommand * gsmc, void * data); void gsm_command_set_error(GSMCommand * gsmc, GSMError error); void gsm_command_set_mode(GSMCommand * gsmc, GSMMode mode); void gsm_command_set_priority(GSMCommand * gsmc, GSMPriority priority);