Permalink
Browse files

Rel 1.0

  • Loading branch information...
1 parent 3a04238 commit 254be8954e4482773623051baf5d4a9c24d387af @fanakin committed May 4, 2012
@@ -86,6 +86,7 @@ typedef struct arnGsmRemoteResponse {
#define TYPEVAL_MGL 1
#define TYPEVAL_MGR 2
#define TYPEVAL_MGD 3
+#define TYPEVAL_MGS 4
/*
* if type == TYPEVAL_MGL
* for Param1 is meaningful index: the index of the message intgo the list
@@ -99,6 +100,10 @@ typedef struct arnGsmRemoteResponse {
* for Param1 is meaningless
* for Param2 is meaningfulless
* for Param3 is meaningful text: ex: "OK"
+ * if type == TYPEVAL_MGS
+ * for Param1 is meaningful index: it says the number of total message sent
+ * for Param2 is meaningfulless
+ * for Param3 is meaningful text: ex: "OK"; message sending report
*/
#define REC_READ 0
#define REC_UNREAD 1
@@ -1,4 +1,5 @@
atCommand_src = WismoManager.c CommandManager.c CommandList.c simple_atoi.c \
+command_NULL.c \
command_AT.c \
command_CPIN.c \
command_CSQ.c \
@@ -106,7 +106,7 @@ void* command_AT(void* cmd, void* data)
}
/**
- * \brief CPIN response handler
+ * \brief AT command generic response handler
* \param cmd pointer to arnGsmRemoteCommand_t structure of the command
* \param data pointer to char string being the answer of the command
* \return NULL if the command doesn't need to dispatch an event and mno error occurs,
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: command_CPIN.h,v 0.1 2012/04/06 16:50:51 fabiogiovagnini Exp $
+ * $Id: command_AT.h,v 0.1 2012/04/06 16:50:51 fabiogiovagnini Exp $
*
* -----------------------------------------------------------------
*
@@ -56,6 +56,7 @@
#include <string.h>
#include "CommandDef.h"
+#include "simple_atoi.h"
#include "command_CMGS.h"
#include "dev/wismo218.h"
@@ -162,9 +163,12 @@ void* response_CMGS(void* cmd, void* data, void* answer)
char *token;
if (cmd == NULL) return NULL;
+ if (answer == NULL) return NULL;
if (data) {
//arnGsmRemoteCommand_t *Command = cmd;
+ arnGsmRemoteResponse_t *res = answer;
char* Dt = data;
+ res->type = TYPEVAL_MGS;
switch (statusCode) {
case NUMBER_TO_CALL_SENT_STATUS:
token = strsep(&Params,"\\");
@@ -195,13 +199,13 @@ void* response_CMGS(void* cmd, void* data, void* answer)
break;
case TOTAL_MGS_NUM_RECIVED_STATUS:
printf("%s%s\r\n",CMGS_info_message_IT[CMGS_info_message_TOTAL_NUM], &(Dt[7]));
+ res->Param1.index = simple_atoi(Dt + 7);
statusCode = OK_ERROR_RECEIVED_STATUS;
break;
case OK_ERROR_RECEIVED_STATUS:
printf("%s%s\r\n",CMGS_info_message_IT[CMGS_info_message_SENDING_REPORT],data);
- if (answer) {
- // action to load meaningful information into answer structure
- }
+ // action to load meaningful information into answer structure
+ strcpy(res->Param3.text,data);
statusCode = NO_STATUS;
break;
default:
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2012, Aurion s.r.l. (Bologna - Italy)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: Command_THEN.c,v 1.0 2012/04/06 17:00:51 fabiogiovagnini Exp $
+ *
+ * -----------------------------------------------------------------
+ *
+ * Author : Fabio Giovagnini, Aurion s.r.l. (Bologna - Italy)
+ * Created : 2012-04-06
+ * Updated : $Date: 2012/04/06 17:00:51 $
+ * $Revision: 1.0 $
+ */
+/**
+ * \addtogroup GENCommand Generic Command implementation
+ *
+ * a generic command prepare a command with its parameters and send it
+ * to the driver understanding. The driver understanding
+ * what the specific hardware expects and send really to the
+ * device.
+ *
+ * @{
+ */
+
+/**
+ * \file
+ * Implementation of the command to enable the Temperature Threshold handler
+ * \author
+ * Fabio Giovagnini <fabio.giovagnini@aurion-tech.com>
+ *
+ */
+#include <string.h>
+
+#include "CommandDef.h"
+#include "command_EREPP.h"
+#include "dev/eeprom.h"
+
+#ifdef CONTIKI_TARGET_ARNNANOM
+#include "printf.h" /* For printf() tiny*/
+#else
+#include <stdio.h> /* For printf() */
+#include "command_NULL.h"
+#endif
+
+
+
+/**
+ * \brief Empty handler
+ * \param cmd pointer to arnGsmRemoteCommand_t structure of the command
+ * \param data pointer to char string being the string including the parameters of the command
+ * \return NULL if the command doesn't need to dispatch an event, unsigned char* if it needs to dispatch an event.
+ * The AT command always needs to return unsigned char* and a returned value of 1
+ *
+ * \retval 0 Not yet implemented
+ * \retval 1 To dispatch the wismo218_command_event
+ *
+ * This function is the generc handler for sending action requests
+ * to am module managed with AT Command.
+ *
+ * Most of the command can be managed with this generic handler,
+ * If an exception will occor a specific handler can be implemented
+ *
+ */
+void* command_NULL(void* cmd, void* data)
+{
+ return NULL;
+}
+
+/**
+ * \brief Empty response handler
+ * \param cmd pointer to arnGsmRemoteCommand_t structure of the command
+ * \param data pointer to char string being the answer of the command
+ * \return NULL if the command doesn't need to dispatch an event and mno error occurs,
+ * unsigned char* if it needs to dispatch an event or an error occurs.
+ *
+ * \retval 0 An error occurs; examine data to know exactly
+ * \retval 1 Not yet implemented
+ *
+ *
+ */
+void* response_NULL(void* cmd, void* data, void* answer)
+{
+ return NULL;
+}
+
+/** @} */
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012, Aurion s.r.l. (Bologna - Italy)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: command_NULL.h,v 0.1 2012/04/06 16:50:51 fabiogiovagnini Exp $
+ *
+ * -----------------------------------------------------------------
+ *
+ * Author : Fabio Giovagnini, Aurion s.r.l. (Bologna - Italy)
+ * Created : 2012-04-06
+ * Updated : $Date: 2012/04/06 16:50:51 $
+ * $Revision: 1.0 $
+ */
+/**
+ * \defgroup GENCommand Generic Empty command implementation
+ *
+ * The target of this module is to supply an extendable way to
+ * implement and manage at AT command to drive a GSM/GPRS module
+ * @{
+ */
+
+#include "contiki.h"
+
+#ifndef __COMMAND_NULL_H__
+#define __COMMAND_NULL_H__
+
+void* command_NULL(void*,void*);
+void* response_NULL(void*,void*,void*);
+
+#endif
+
+/** @} */

0 comments on commit 254be89

Please sign in to comment.