GPRS: Remove Grove Dependency

Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit is contained in:
Abhishek Malik 2016-09-13 12:12:50 -07:00 committed by Noel Eck
parent f4315db035
commit db05211516
11 changed files with 52 additions and 52 deletions

View File

@ -213,7 +213,7 @@ add_example (loudness)
add_example (mg811)
add_example (wheelencoder)
add_example (sm130)
add_example (grovegprs)
add_example (gprs)
add_example (lm35)
add_example (micsv89)
add_example (xbee)

View File

@ -26,7 +26,7 @@
#include <iostream>
#include <signal.h>
#include <stdio.h>
#include "grovegprs.hpp"
#include "gprs.hpp"
using namespace std;
using namespace upm;
@ -48,7 +48,7 @@ void printUsage(char *progname)
}
// simple helper function to send a command and wait for a response
void sendCommand(upm::GroveGPRS* sensor, string cmd)
void sendCommand(upm::GPRS* sensor, string cmd)
{
// commands need to be terminated with a carriage return
cmd += "\r";
@ -71,8 +71,8 @@ int main(int argc, char **argv)
{
//! [Interesting]
// Instantiate a GroveGPRS Module on UART 0
upm::GroveGPRS* sensor = new upm::GroveGPRS(0);
// Instantiate a GPRS Module on UART 0
upm::GPRS* sensor = new upm::GPRS(0);
// Set the baud rate, 19200 baud is the default.
if (sensor->setBaudRate(19200) != mraa::SUCCESS)
@ -108,4 +108,4 @@ int main(int argc, char **argv)
delete sensor;
return 0;
}
}

View File

@ -23,7 +23,7 @@
*/
var sensorObj = require('jsupm_grovegprs');
var sensorObj = require('jsupm_gprs');
/************** Functions **************/
@ -57,8 +57,8 @@ function sendCommand(sensor, cmd, callback)
}
/************** Main code **************/
// Instantiate a GROVEGPRS Module on UART 0
var sensor = new sensorObj.GroveGPRS(0);
// Instantiate a GPRS Module on UART 0
var sensor = new sensorObj.GPRS(0);
// Set the baud rate, 19200 baud is the default.
if (sensor.setBaudRate(19200))
@ -70,7 +70,7 @@ if (sensor.setBaudRate(19200))
printUsage(process.argv[1]);
// Note: in nodeJS, command-line argument 0 is "node".
// Command-line argument 1 is "grovegprs.js"
// Command-line argument 1 is "gprs.js"
// If you have a third argument, then it's a command
if (process.argv.length > 2)
{

View File

@ -22,10 +22,10 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import time, sys, signal, atexit
import pyupm_grovegprs as sensorObj
import pyupm_gprs as sensorObj
# Instantiate a GroveGPRS Module on UART 0
sensor = sensorObj.GroveGPRS(0)
# Instantiate a GPRS Module on UART 0
sensor = sensorObj.GPRS(0)
## Exit handlers ##
# This stops python from printing a stacktrace when you hit control-C

5
src/gprs/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
upm_mixed_module_init (NAME gprs
DESCRIPTION "upm grove GPRS module"
CPP_HDR gprs.hpp
CPP_SRC gprs.cxx
REQUIRES mraa)

View File

@ -24,50 +24,50 @@
#include <iostream>
#include "grovegprs.hpp"
#include "gprs.hpp"
using namespace upm;
using namespace std;
static const int defaultDelay = 100; // max wait time for read
GroveGPRS::GroveGPRS(int uart) :
GPRS::GPRS(int uart) :
m_uart(uart)
{
}
GroveGPRS::~GroveGPRS()
GPRS::~GPRS()
{
}
bool GroveGPRS::dataAvailable(unsigned int millis)
bool GPRS::dataAvailable(unsigned int millis)
{
return m_uart.dataAvailable(millis);
}
int GroveGPRS::readData(char *buffer, unsigned int len)
int GPRS::readData(char *buffer, unsigned int len)
{
return m_uart.read(buffer, len);
}
std::string GroveGPRS::readDataStr(int len)
std::string GPRS::readDataStr(int len)
{
return m_uart.readStr(len);
}
int GroveGPRS::writeData(char *buffer, unsigned int len)
int GPRS::writeData(char *buffer, unsigned int len)
{
m_uart.flush();
return m_uart.write(buffer, len);
}
int GroveGPRS::writeDataStr(std::string data)
int GPRS::writeDataStr(std::string data)
{
m_uart.flush();
return m_uart.writeStr(data);
}
mraa::Result GroveGPRS::setBaudRate(int baud)
mraa::Result GPRS::setBaudRate(int baud)
{
return m_uart.setBaudRate(baud);
}

View File

@ -36,27 +36,27 @@
#include <mraa/common.hpp>
#include <mraa/uart.hpp>
#define GROVEGPRS_DEFAULT_UART 0
#define GPRS_DEFAULT_UART 0
namespace upm {
/**
* @brief Grove GPRS Module library
* @defgroup grovegprs libupm-grovegprs
* @brief GPRS Module library
* @defgroup gprs libupm-gprs
* @ingroup seeed uart wifi
*/
/**
* @library grovegprs
* @sensor grovegprs
* @comname Grove GPRS Module
* @library gprs
* @sensor gprs
* @comname GPRS Module
* @type wifi
* @man seeed
* @con uart
* @web http://www.seeedstudio.com/wiki/GPRS_Shield_V2.0
*
* @brief API for the Grove GPRS Module
* @brief API for the GPRS Module
*
* The driver was tested with the Grove GPRS Module, V2. It's a
* The driver was tested with the GPRS Module, V2. It's a
* GSM GPRS module based on the SIM900. This module uses a
* standard 'AT' command set. See the datasheet for a full list
* of available commands and their possible responses:
@ -65,24 +65,24 @@ namespace upm {
*
* It is connected via a UART at 19200 baud.
*
* @image html grovegprs.jpg
* @snippet grovegprs.cxx Interesting
* @image html gprs.jpg
* @snippet gprs.cxx Interesting
*/
class GroveGPRS {
class GPRS {
public:
/**
* GroveGPRS object constructor
* GPRS object constructor
*
* @param uart Default UART to use (0 or 1). Default is 0.
*/
GroveGPRS(int uart=GROVEGPRS_DEFAULT_UART);
GPRS(int uart=GPRS_DEFAULT_UART);
/**
* GroveGPRS object destructor
* GPRS object destructor
*/
~GroveGPRS();
~GPRS();
/**
* Checks to see if there is data available for reading

View File

@ -1,19 +1,19 @@
%module javaupm_grovegprs
%module javaupm_gprs
%include "../upm.i"
%include "carrays.i"
%include "std_string.i"
%{
#include "grovegprs.hpp"
#include "gprs.hpp"
%}
%include "grovegprs.hpp"
%include "gprs.hpp"
%array_class(char, charArray);
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("javaupm_grovegprs");
System.loadLibrary("javaupm_gprs");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);

View File

@ -1,11 +1,11 @@
%module jsupm_grovegprs
%module jsupm_gprs
%include "../upm.i"
%include "carrays.i"
%include "std_string.i"
%{
#include "grovegprs.hpp"
#include "gprs.hpp"
%}
%include "grovegprs.hpp"
%include "gprs.hpp"
%array_class(char, charArray);

View File

@ -1,6 +1,6 @@
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%module pyupm_grovegprs
%module pyupm_gprs
%include "../upm.i"
%include "carrays.i"
%include "std_string.i"
@ -8,7 +8,7 @@
%feature("autodoc", "3");
%{
#include "grovegprs.hpp"
#include "gprs.hpp"
%}
%include "grovegprs.hpp"
%include "gprs.hpp"
%array_class(char, charArray);

View File

@ -1,5 +0,0 @@
set (libname "grovegprs")
set (libdescription "upm grove GPRS module")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init()