mirror of
https://github.com/eclipse/upm.git
synced 2025-06-10 07:10:22 +03:00
java: fix Java types for ZFM20
Signed-off-by: Petre Eftime <petre.p.eftime@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
3d74ea9820
commit
ebdb4f10d1
@ -4,16 +4,30 @@
|
|||||||
%include "typemaps.i"
|
%include "typemaps.i"
|
||||||
%include "arrays_java.i";
|
%include "arrays_java.i";
|
||||||
|
|
||||||
%apply unsigned char[] { unsigned char *pkt };
|
|
||||||
%apply signed char[] { char *buffer };
|
|
||||||
|
|
||||||
%apply uint16_t *OUTPUT { uint16_t *id, uint16_t *score };
|
%apply uint16_t *OUTPUT { uint16_t *id, uint16_t *score };
|
||||||
|
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include "zfm20.h"
|
#include "zfm20.h"
|
||||||
speed_t int_B57600 = B57600;
|
speed_t int_B57600 = B57600;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
%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"
|
%include "zfm20.h"
|
||||||
speed_t int_B57600 = B57600;
|
speed_t int_B57600 = B57600;
|
||||||
|
@ -229,7 +229,7 @@ uint32_t ZFM20::getMillis()
|
|||||||
return elapse;
|
return elapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZFM20::verifyPacket(unsigned char *pkt)
|
bool ZFM20::verifyPacket(unsigned char *pkt, int len)
|
||||||
{
|
{
|
||||||
// verify packet header
|
// verify packet header
|
||||||
if (pkt[0] != ZFM20_START1 || pkt[1] != ZFM20_START2)
|
if (pkt[0] != ZFM20_START1 || pkt[1] != ZFM20_START2)
|
||||||
@ -291,7 +291,7 @@ bool ZFM20::getResponse(unsigned char *pkt, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now verify it.
|
// now verify it.
|
||||||
return verifyPacket(pkt);
|
return verifyPacket(pkt, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZFM20::verifyPassword()
|
bool ZFM20::verifyPassword()
|
||||||
|
@ -212,9 +212,10 @@ namespace upm {
|
|||||||
* Verifies the packet header and indicates its validity
|
* Verifies the packet header and indicates its validity
|
||||||
*
|
*
|
||||||
* @param pkt Packet to check
|
* @param pkt Packet to check
|
||||||
|
* @param len Length of packet
|
||||||
* @return True if the checksum is valid, false otherwise
|
* @return True if the checksum is valid, false otherwise
|
||||||
*/
|
*/
|
||||||
bool verifyPacket(unsigned char *pkt);
|
bool verifyPacket(unsigned char *pkt, int len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of milliseconds elapsed since initClock()
|
* Returns the number of milliseconds elapsed since initClock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user