Hi all.
I try to use: set global totalChunks to join "" (call TextBox.Text get global totalChunks), seems there is not an event to do it? or other solution?
I've tested: join "" + global totalChunks, still got unable to convert error.
... it might be too long for your receiving code but we have not seen it. It is good practice to keep data as short as possible. For example, you are sending the word "CHUNK" to identify a String - use a single character instead, e.g. "C".
Since you are using BLE, it is possible that the BLE data 'parcel' can be increased in size if necessary - default size is only 20bytes.
You have to take the length of whatever piece of text you have left near the end of the long string you are cutting into chunks, and do the arithmetic to see how long that final fragment is.
The segment block does not suffer impossible requests, so you have to take care to give it actionable parameters.
the puepose is sending the CHUNKS one by one till end with timeInterval 200. the clock should start AfterResizeImage, but the it started as long as APP run and got error:
If you are sending 20 byte strings, this is the block to use instead of WriteBytes (which wants a list of numbers 0-255):
WriteStringsWithResponse – Writes one or more strings to a connected BluetoothLE device and waits for an acknowledgement via the StringsWritten event. Service Unique ID and Characteristic Unique ID are required. The values parameter can either be a single string or a list of values. If utf16 is true, the string(s) will be sent using UTF-16 little endian encoding. If utf16 is false, the string(s) will be sent using UTF-8 encoding.Parameters:
serviceUuid (text) — The unique identifier of the service passed in the read or register call.
characteristicUuid (text) — The unique identifier of the characteristic in the read or register call.
utf16 (boolean) Send the string encoded as UTF-16 little endian (true) or UTF-8 (false) code points.
values (list) — A list of values to write to the device.
Notice the mention of the event that fires on successful completion of the Write:
StringsWritten – The StringsWritten event is run when one or more strings are written to a connected Bluetooth device. stringValues will be a list of values actually written to the device. This may be different if the original input was too long to fit into a single transmission unit (typically 22 bytes).Parameters:
serviceUuid (text) — The unique identifier of the service passed in the read or register call.
characteristicUuid (text) — The unique identifier of the characteristic in the read or register call.
stringValues (list) — A list of values written to the device.
This event block is the place where you look to see how far down that long piece of text you have gotten, and to see if there is enough left to send another chunk. You would send that chunk from here, no Clock Timer needed.
After that chunk is sent, the Event would fire again, with either a shorter remaining global text variable or a higher index into the global text value, depending how you choose to manage traversing the long text.
P.S. These block helps are for the CURRENT BLE extension, which is more recent than you have in your posted aia.