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,6 +3,7 @@
%include "stdint.i"
%include "typemaps.i"
%include "arrays_java.i";
%include "../java_buffer.i";
%apply uint16_t *OUTPUT { uint16_t *id, uint16_t *score };
@ -12,22 +13,5 @@
%}
%typemap(jni) (char *buffer, size_t len) "jbyteArray";
%typemap(jtype) (char *buffer, size_t len) "byte[]";
%typemap(jstype) (char *buffer, size_t len) "byte[]";
%typemap(javain) (char *buffer, size_t len) "$javainput";
%typemap(in) (char *buffer, size_t len) {
$1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, NULL);
$2 = JCALL1(GetArrayLength, jenv, $input);
}
%typemap(freearg) (char *buffer, size_t len) {
JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
}
%apply (char *buffer, size_t len) { (unsigned char *pkt, int len) };
%include "zfm20.h"
speed_t int_B57600 = B57600;

View File

@ -97,7 +97,7 @@ bool ZFM20::dataAvailable(unsigned int millis)
return false;
}
int ZFM20::readData(char *buffer, size_t len)
int ZFM20::readData(char *buffer, int len)
{
if (m_ttyFd == -1)
return(-1);
@ -113,7 +113,7 @@ int ZFM20::readData(char *buffer, size_t len)
return rv;
}
int ZFM20::writeData(char *buffer, size_t len)
int ZFM20::writeData(char *buffer, int len)
{
if (m_ttyFd == -1)
return(-1);
@ -162,9 +162,9 @@ bool ZFM20::setupTty(speed_t baud)
return true;
}
int ZFM20::writeCmdPacket(unsigned char *pkt, int len)
int ZFM20::writeCmdPacket(uint8_t *pkt, int len)
{
unsigned char rPkt[ZFM20_MAX_PKT_LEN];
uint8_t rPkt[ZFM20_MAX_PKT_LEN];
rPkt[0] = ZFM20_START1; // header bytes
rPkt[1] = ZFM20_START2;
@ -229,7 +229,7 @@ uint32_t ZFM20::getMillis()
return elapse;
}
bool ZFM20::verifyPacket(unsigned char *pkt, int len)
bool ZFM20::verifyPacket(uint8_t *pkt, int len)
{
// verify packet header
if (pkt[0] != ZFM20_START1 || pkt[1] != ZFM20_START2)
@ -249,7 +249,7 @@ bool ZFM20::verifyPacket(unsigned char *pkt, int len)
return true;
}
bool ZFM20::getResponse(unsigned char *pkt, int len)
bool ZFM20::getResponse(uint8_t *pkt, int len)
{
char buf[ZFM20_MAX_PKT_LEN];
@ -311,7 +311,7 @@ bool ZFM20::verifyPassword()
// now read a response
const int rPktLen = 12;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -335,7 +335,7 @@ int ZFM20::getNumTemplates()
// now read a response
const int rPktLen = 14;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -371,7 +371,7 @@ bool ZFM20::setNewPassword(uint32_t pwd)
// now read a response
const int rPktLen = 12;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -409,7 +409,7 @@ bool ZFM20::setNewAddress(uint32_t addr)
// now read a response
const int rPktLen = 12;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -443,7 +443,7 @@ uint8_t ZFM20::generateImage()
// now read a response
const int rPktLen = 12;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -474,7 +474,7 @@ uint8_t ZFM20::image2Tz(int slot)
// now read a response
const int rPktLen = 12;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -498,7 +498,7 @@ uint8_t ZFM20::createModel()
// now read a response
const int rPktLen = 12;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -531,7 +531,7 @@ uint8_t ZFM20::storeModel(int slot, uint16_t id)
// now read a response
const int rPktLen = 12;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -559,7 +559,7 @@ uint8_t ZFM20::deleteModel(uint16_t id)
// now read a response
const int rPktLen = 12;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -583,7 +583,7 @@ uint8_t ZFM20::deleteDB()
// now read a response
const int rPktLen = 12;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -622,7 +622,7 @@ uint8_t ZFM20::search(int slot, uint16_t *id, uint16_t *score)
// now read a response
const int rPktLen = 16;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{
@ -655,7 +655,7 @@ uint8_t ZFM20::match(uint16_t *score)
// now read a response
const int rPktLen = 14;
unsigned char rPkt[rPktLen];
uint8_t rPkt[rPktLen];
if (!getResponse(rPkt, rPktLen))
{

View File

@ -179,7 +179,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
@ -188,7 +188,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. For this device,
@ -206,7 +206,7 @@ namespace upm {
* @param len Length of packet
* @return Number of bytes written
*/
int writeCmdPacket(unsigned char *pkt, int len);
int writeCmdPacket(uint8_t *pkt, int len);
/**
* Verifies the packet header and indicates its validity
@ -215,7 +215,7 @@ namespace upm {
* @param len Length of packet
* @return True if the packet is valid, false otherwise
*/
bool verifyPacket(unsigned char *pkt, int len);
bool verifyPacket(uint8_t *pkt, int len);
/**
* Returns the number of milliseconds elapsed since initClock()
@ -253,7 +253,7 @@ namespace upm {
* large
* @return True if successful
*/
bool getResponse(unsigned char *pkt, int len);
bool getResponse(uint8_t *pkt, int len);
/**
* Verifies and authenticates to the module. The password used is