OutputPort and blobs, do they work?

Does the OutputPort class work correctly with blobs? I can’t seem to get anything to transfer.

With the following code and ‘12345’ in the blob i get the following at the other end of an http request (JSON)

body{ “channel”: 1, “target”: “30ba9435da0aa736” } (no blob at all)

and

body{ “channel”: 1, “target”: “30ba9435da0aa736”, “value”: “12345” } (blob converted to string before ‘set’)

`class impeeOut extends OutputPort
{
name = “UART In”;
type = “string”;

function set(s)
{
    log("impeeOut",s);
    base.set(s);               // send the blob
    imp.sleep(0.1);
    local out = "";
    s.seek(0);
    while(!s.eos()) 
    {
        out += s.readn('b').tochar();  //convert the blob to string (painful, must be a better way)
    }
    base.set(out);                            // send the string
}

}`

You’re absolutely right, this does not in fact work in release-7. We have a fix and it will be in a future release, probably the next one.

Peter

:slight_smile: Thanks, learning Squirrel and running up against things that don’t quite work yet make it interesting At least it gets me to write test code.