missing native methods

120 views
Skip to first unread message

cyshooter

unread,
Jun 18, 2012, 3:20:57 AM6/18/12
to Sedona Framework
Hello everyone, i'm trying to implement the native method doInit,
doClose of serial communication in the ubuntu. there is my files and
directories:
serialcomm/
+- kit.xml
+- SerialCommu.sedona
+-SerialPortTest.sedona
+- native/
| | +- qnx/
| | +- serialcomm_SerialCommu_qnx.c
| | +-serialQnx.h


serialApp/
+- kits.xml
+- app.sax
+-unix-serial.xml //platform definition
+- tempstage/ some .c source file

i can sedonac the *.xml and *.sax, but when i run the command "svm --
plat", the compiler says:
Running SVM in Platform Mode
-- MESSAGE [sys::App] starting
-- MESSAGE [sox::SoxService] started port=1876
-- MESSAGE [web::WebService] started port=8080
-- MESSAGE [sys::App] running
ERROR: missing native method 3::0

i can find the native method id in the serialApp/tempstage/
nativetable.c, how can i do these problem, thank a lot!
best regards!

cyshooter

unread,
Jun 18, 2012, 4:35:54 AM6/18/12
to Sedona Framework
there are some sourcefile:
serialcomm/
+- kit.xml
<sedonaKit
name = "serialcomm"
vendor = "Tridium"
description = "Serial I/O test in the ubuntu"
includeSource = "true"
doc = "true"
>

<!-- Dependencies -->
<depend on="sys 1.0" />

<!-- Source Directories -->
<source dir="." />
<source dir="test" testonly="true" />

<!-- Natives -->
<native qname="serialcomm::SerialCommu.doInit" id="3::0"/>
<native qname="serialcomm::SerialCommu.doClose" id="3::1"/>
<native qname="serialcomm::SerialCommu.doRead" id="3::2"/>
<native qname="serialcomm::SerialCommu.doWrite" id="3::3"/>
<native qname="serialcomm::SerialCommu.doReadBytes" id="3::4"/>
<native qname="serialcomm::SerialCommu.doWriteBytes" id="3::5"/>

</sedonaKit>

cyshooter

unread,
Jun 18, 2012, 4:41:31 AM6/18/12
to Sedona Framework
serialcomm/
+- SerialCommu.sedona

final class SerialCommu
{

public int portNum =1;


define int PARITY_DISABLED = 0

define int PARITY_NONE = 0

define int PARITY_ODD = 1

define int PARITY_EVEN = 2

define int PARITY_MARK = 3

define int PARITY_SPACE = 4

define int RTS_LOW = 0

define int RTS_HIGH = 1

public int baudRate = 9600

public int dataBits = 8

public int stopBits = 1

public int parity = PARITY_NONE

public int rtsLevel = RTS_LOW


inline SerialInStream in

inline SerialOutStream out

internal native int doInit(int port, int baud, int datab, int
stopb, int par, int rts)

internal native int doClose(int port)

internal native int doRead(int port)

internal native int doWrite(int port, int c)

internal native int doReadBytes(int port, byte[] y, int off, int
len)

internal native int doWriteBytes(int port, byte[] y, int off, int
len)


SerialCommu()
{

this.out.port = this
this.in.port = this
}

int setParams(int port, int baud, int dataB, int stopB, int par, int
rts)
{
this.portNum = port
this.baudRate = baud
this.dataBits = dataB
this.stopBits = stopB
this.parity = par
this.rtsLevel = rts

return 0
}


int open()
{
return doInit(portNum, baudRate, dataBits, stopBits, parity,
rtsLevel)
}

int close()
{
return doClose(portNum)
}
}

internal class SerialOutStream extends OutStream
{

override bool write(int b)
{
return port.doWrite(port.portNum, b) == 0
}

override bool writeBytes(byte[] b, int off, int len)
{
return port.doWriteBytes(port.portNum, b, off, len) == len
}

SerialCommu port
}

internal class SerialInStream extends InStream
{

override int read()
{
return port.doRead(port.portNum)
}

override int readBytes(byte[] b, int off, int len)
{
return port.doReadBytes(port.portNum, b, off, len)
}

SerialCommu port
}
Reply all
Reply to author
Forward
0 new messages