java: Changed size_t and unsigned int to int in array declarations. Renamed buf to buffer where necesarry. Moved most Java array typemaps to java_buffer.i. Fixed some String buffers.

Signed-off-by: Petre Eftime <petre.p.eftime@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>

Conflicts:
	src/upm.i
This commit is contained in:
Petre Eftime
2015-09-07 19:00:30 +03:00
committed by Mihai Tudor Panu
parent ab730038fd
commit 2cab79b4c2
50 changed files with 237 additions and 326 deletions

View File

@ -3,8 +3,7 @@
%include "cpointer.i"
%include "typemaps.i"
%include "arrays_java.i";
%apply signed char[] {unsigned char *};
%include "../java_buffer.i"
%apply int *OUTPUT { int *gas, int *temp };

View File

@ -91,7 +91,7 @@ bool MHZ16::dataAvailable(unsigned int millis)
return false;
}
int MHZ16::readData(char *buffer, size_t len)
int MHZ16::readData(char *buffer, int len)
{
if (m_ttyFd == -1)
return(-1);
@ -107,7 +107,7 @@ int MHZ16::readData(char *buffer, size_t len)
return rv;
}
int MHZ16::writeData(char *buffer, size_t len)
int MHZ16::writeData(char *buffer, int len)
{
if (m_ttyFd == -1)
return(-1);
@ -156,7 +156,7 @@ bool MHZ16::setupTty(speed_t baud)
return true;
}
bool MHZ16::verifyPacket(unsigned char *pkt)
bool MHZ16::verifyPacket(uint8_t *pkt, int len)
{
if (pkt[0] != 0xff || pkt[1] != 0x86)
{
@ -193,7 +193,7 @@ bool MHZ16::getData(int *gas, int *temp)
return false;
}
if (!verifyPacket(packet))
if (!verifyPacket(packet, 9))
{
cerr << __FUNCTION__ << ": Packet verify failed." << endl;
return false;

View File

@ -106,7 +106,7 @@ namespace upm {
* @param len Length of the buffer
* @return Number of bytes read
*/
int readData(char *buffer, size_t len);
int readData(char *buffer, int len);
/**
* Writes the data in the buffer to the device
@ -115,7 +115,7 @@ namespace upm {
* @param len Length of the buffer
* @return Number of bytes written
*/
int writeData(char *buffer, size_t len);
int writeData(char *buffer, int len);
/**
* Sets up proper tty I/O modes and the baud rate. The default
@ -132,7 +132,7 @@ namespace upm {
* @param pkt Packet to check
* @return True if the checksum is valid, false otherwise
*/
bool verifyPacket(unsigned char *pkt);
bool verifyPacket(uint8_t *pkt, int len);
/**
* Queries the sensor and returns gas (CO2) concentration and