I was wondering if it were possible to actually have an array as a member of the the source array that's being serialized by B4RSerializator . For example:
I have an array my_array with the int type elements. I also have another value called num - I want to serialize both. Can I do that like the above? Using:
Dim byte_array() As Byte = serializator.ConvertArrayToBytes(Array(num,my_array))
Interestingly when I test it out, it compiles. When I de-serialize and get what I think is the de-serialized array, I seem to only get the first element (in this case 100) and the incorrect numbers for elments 2 and 3. Interestingly it seems to loop through the correct number of elements in the de-serialized array however all but the first element is correct. It obviously all compiles (I was a little surprised that it did). Should this work, can I make something like this work?
Ultimately I would use something like this to possibly send infrared codes which would be something like this:
To my ESP8266 and have it blast that IR signal. I could potentially covert to string and send like this:
However that might save me the hassle of going through the convert form string to ULONG Array and vice/versa.
Thoughts?
B4X:
Dim my_array() As Int = Array As Int(100,200,300)
Dim num As Int = 1111
Dim byte_array() As Byte = serializator.ConvertArrayToBytes(Array(num,my_array))
Dim length As Int = byte_array.Length
Dim Objects() As Object = serializator.ConvertBytesToArray(byte_array, ObjectsBuffer)
Dim tmp_array() As Int = Objects(1) 'should be the same as my_array
For Each o As Int In tmp_array
Log(o)
Next
I have an array my_array with the int type elements. I also have another value called num - I want to serialize both. Can I do that like the above? Using:
Dim byte_array() As Byte = serializator.ConvertArrayToBytes(Array(num,my_array))
Interestingly when I test it out, it compiles. When I de-serialize and get what I think is the de-serialized array, I seem to only get the first element (in this case 100) and the incorrect numbers for elments 2 and 3. Interestingly it seems to loop through the correct number of elements in the de-serialized array however all but the first element is correct. It obviously all compiles (I was a little surprised that it did). Should this work, can I make something like this work?
Ultimately I would use something like this to possibly send infrared codes which would be something like this:
B4X:
Private ircode() As Int = Array As Int(8950,4550,500,650,550,1750,500,1750,500,650,500,650,500,650,500,650,500,1750,500,1750,500,650,500,1750,500,650,500,650,500,650,500,650,500,650,500,1750,550,1750,500,1750,500,1750,500,650,500,650,500,650,550,650,500,650,500,650,500,650,500,650,500,1750,500,1750,500,1750,500,1750,550)
To my ESP8266 and have it blast that IR signal. I could potentially covert to string and send like this:
B4X:
Private ircode_str As String = "8950,4550,500,650,550,1750,500,1750,500,650,500,650,500,650,500,650,500,1750,500,1750,500,650,500,1750,500,650,500,650,500,650,500,650,500,650,500,1750,550,1750,500,1750,500,1750,500,650,500,650,500,650,550,650,500,650,500,650,500,650,500,650,500,1750,500,1750,500,1750,500,1750,550"
However that might save me the hassle of going through the convert form string to ULONG Array and vice/versa.
Thoughts?