B4J Question Inconvertible types

HARRY

Active Member
Licensed User
Hi,

When compiling my first B4j program, I get following message:

B4J version 2.80
Parsing code. 0.00
Compiling code. 0.03
Compiling debugger engine code. 0.64
Compiling generated Java code. Error
B4J line: 82
registrationmsg = s
javac 1.7.0_45
src\b4j\example\main.java:242: error: inconvertible types
_registrationmsg = (b4j.example.main._registrationmsgstruct)(_s);
^
required: _registrationmsgstruct
found: String
1 error


I wonder what 'B4j line : 82' means, certainly not the line number of my source code. That reads ' i=23'.

B4j-Bridge is connected.

More important what causes this error message? Should I register something?

Harry
 

HARRY

Active Member
Licensed User
Hi Erel,

I see the problem, but not yet the solution. Yesterday I was sleepy and confused by the line number. I thought 'registration', what registration? Registrationmsg is a structure I declared myself; s is a String.
Part of the code is as follows:

Type registrationmsgstruct(length As Long,src As Byte, ack As Byte, eleccountday As Long, eleccountnight As Long, elecconsumption As Long, gasdatetime(13) As Char, gascount As Long, msgnr As Byte)
Dim registrationmsg As registrationmsgstruct


Sub AStream_NewData (Buffer() As Byte)
Dim s As String = BytesToString(Buffer, 0, Buffer.Length, "UTF8")

registrationmsg = s This is the line which gives the problem, I assume. The buffer should be copied to the structure as a serie of bytes. The length is exactly the same.

How can I do that? A kind of memcpy would be usefull. On internet I find something like that, but then I need the Class System, which I cannot find. Also a complete sample would be nice.

Harry
 
Last edited:

HARRY

Active Member
Licensed User
Erel,

Unfortunately I cannot use sending objects as the 'other' side is an Arduino computer. I will look for another solution.

Harry
 
Top