Facility Control

 View Only
  • 1.  TCP Control of Utah Scientific Router

    Posted 10-19-2021 09:39
    I am working on a grid to control a Utah UDS100 frame with SC40E control system. 
    I am missing something and hope someone can fill in the gap. I can control the router with a packet sender and the control system responds and makes the route.
    Command sent with Packet Sender- 12 00 1f 00 00 08 00 10 00 0e 00 00 00 01
    RCP4 take: ip = 0xc0a80115, src = 16, dst = 14, levels = 0x00000001 node 0
    UTAH router take: input 16, output 14, levels 0x00000001​

    But sending the same command with rosstalk.sendAsBytes results in an error on the control system. 
    RCP4 take: ip = 0xc0a80115, src = 16, dst = 14, levels = 0x00000001 node 0
    UTAH router take: input 16, output 14, levels 0x00000001
    newSockSrv.c 849: ERROR reading I/O stream 3 0 0​

    Here is what I have so far-

    function decimalToHex(d, padding) {
        var hex = Number(d).toString(16);
        padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding;
    
        while (hex.length < padding) {
            hex = "0" + hex;
        }
    
        return hex;
    }
    
    function callback(success, sentData, resultString, exception)
    {
        ogscript.debug("success: " + success);
        ogscript.debug("sentData: " + sentData);
        ogscript.debug("resultString: " + resultString);
        ogscript.debug("exception: " + exception);
    }
    
    //Set Src and Dst
    var src= 16;
    var dst = 14;
    var chksum = src+dst+1;
    
    //Convert to Hex
    var hexsum = decimalToHex (chksum); 
    var hexSrc = decimalToHex (src); 
    var hexDst = decimalToHex (dst); 
    
    //Set Payload Data
    var dataone = '12 00 ' +hexsum +' 00 00 08';
    var datatwo = ' 00 ' +hexSrc +' 00 ' +hexDst +' 00 00 00 01';
    var payload = '12 00 ' +hexsum +' 00 00 08' +' 00 ' +hexSrc +' 00 ' +hexDst +' 00 00 00 01';
    //ogscript.debug (dataone +' ' +datatwo);
    ogscript.debug('Payload- ' +payload);
    ogscript.debug ('Source = ' +src +' Hex- ' +hexSrc +' Destination = ' +dst +' Hex- ' +hexDst +' Checksum= ' +chksum +' HexSum- ' +hexsum);
    
    //Send message to Router
    rosstalk.sendAsBytes('10.175.5.230', 5001, payload, callback);

     

    -Chris

    ------------------------------
    chris kean
    Community Focus
    ------------------------------


  • 2.  RE: TCP Control of Utah Scientific Router

    Posted 10-20-2021 14:39
    Hi Chris,

    I do not see any issues with your code. It seems to create the payload you are expecting.

    The rosstalk.sendAsBytes will parse each ascii-encoded byte into its binary equivalent and send that byte array. So your code would send the binary byte array:
    [0x12, 0x00, 0x1f, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x01]

    Is it possible the packet sender is sending the bytes as ascii instead of binary? I would be curious to see how the two messages compare when captured in Wireshark.

    Please let me know if you have any questions.

    ------------------------------
    Dave Sampson
    Ross Video
    ------------------------------



  • 3.  RE: TCP Control of Utah Scientific Router

    Posted 10-21-2021 09:29
    Thanks Dave. 
    I did not try binary, because it seemed like the messages are arriving ok but I wasn't handling something properly. I should have also attached some wireshark grabs. See below. 



    ------------------------------
    chris kean
    Community Focus
    ------------------------------



  • 4.  RE: TCP Control of Utah Scientific Router

    Posted 10-26-2021 17:16
    Your packet sender and the rosstalk command must be doing something different from each other. The rosstalk.sendAsBytes will parse each ascii-encoded byte into its binary equivalent and send that byte array.

    Are you using an ascii protocol with your packet sender?

    ------------------------------
    Dave Sampson
    Ross Video
    ------------------------------