Announcement

Collapse
No announcement yet.

Turning on XML-RPC

Collapse
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Turning on XML-RPC

    Problem:
    I have been using SNAP Connect on my PC to interface my application to the SNAP network. I recently tried using an E10 with my existing setup but cannot get SNAP Connect to communicate with the E10.

    How do I use the E10 with my existing setup, allowing my application to interface through the E10 to my SNAP network?

    Solution:
    The E10 comes with a version of SNAP Connect that does not support the XML-RPC functions by default. The version of SNAP Connect on the E10 is running once powered up so in order to launch the XML-RPC version then SNAP Connect on the E10 must be stopped as follows:

    E10 Device Configuration:
    - Open a serial connection (115.2K baud) to the E10 via micro-USB connector (also used for power).
    - Login into Linux command line as “root” user
    - Determine if a SNAPconnect process is already running by issuing “ps | grep UserMain.py”
    o If it exits, kill this process by typing “/etc/init.d/S999snap stop” or “kill <insert process ID>”
    Note: the process ID will be the number to the far left on ht esame line.
    - Launch the XML-RPC process by typing “python /Snap/SnapXmlRpc.pyc”
    - Note the SNAP address of the SNAPConnect process (different from the SNAP address of the radio front-end of the E10)
    o This SNAP address mirrors the last 6 digits of the Ethernet MAC address of the E10 as the SNAP source address.
    o Example: if your device has an Ethernet MAC address of 00:1C:2C:FF:9C:06 (from ifconfig at a Linux prompt) then you would use ff.9c.06 for your SNAP connect address in your application.

    SNAP Connect Modifications:
    if you have an existing application that operates with the PC-Software based SNAPConnect server (like the example client examples installed to the C:\Program Files\SNAPconnect\Client Examples directory)
    - Client SNAP Address: Change your PC based client application such that RPCs and WaitOnEvent calls use the SNAP address of the remote SNAP Connect server
    o This will be the last 6 digits of the Ethernet MAC address of the E10 as the SNAP source address (the value noted when connected to the E10 command line)
    o The Software version of SNAP connect allowed the user select value between 00.00.01 and .0F for each client application.
    - Serial connection: Modify instances within the client application where “connectSerial” is used. The E10 uses a direct connection to connectSerial(1, '/dev/ttyS1').

    Note: The file “/etc/inittab” holds configuration parameters applied at bootup. Changes must be made to this file in order for settings to persist past reboot.

    Automatic setup .................
    In the following file is the code that launches the UserMain by default. You could edit this file to perform the steps automatically. There is a backup file called SynapseMain.py in case the UserMain.py gets corrupted.

    /etc/init.d (directory)

    Filename is S999SNAP (not sure about the number of 9’s)
    Last edited by gvoce; 01-28-2014, 10:37 AM.

  • #2
    Hello,

    Thanks, this was super useful!!

    Serge

    Comment


    • #3
      How would I modify this code (from the C# example) to connect to the E10? The E10 is connected to my router and has an assigned IP address. I have started the XML-RPC server on the E10 using a ssh terminal.

      Thanks!

      Code:
       private void btnSetupConn_Click(object sender, EventArgs e)
              {
                  if (cboPortType.Text == "" && cboPortNum.Text == "")
                  {
                      MessageBox.Show("Please select a Port Type and Port Number");
                  }
                  else
                  {
                      switch ((string)cboPortType.SelectedItem)
                      {
                          case "USB":
                              proxy.BeginConnectSerial((int)SerialType.USB, (int)cboPortNum.SelectedItem, this.chkReconnect.Checked, this.SerialConnectCallback);
                              break;
                          case "RS232":
                              proxy.BeginConnectSerial((int)SerialType.RS232, (int)cboPortNum.SelectedItem, this.chkReconnect.Checked, this.SerialConnectCallback);
                              break;                  
                          default:
                              MessageBox.Show("Unknown Port Type selected");
                              break;
                      }
                  }
              }

      Comment


      • #4
        The address you want to connect to is actually in the XmlRpcInterface.cs file. You should see something like:
        Code:
        [XmlRpcUrl("http://localhost:8080")]
        You'll probably also need to modify the definition for "connectSerial" so it can accept a string as the port:
        Code:
        [XmlRpcMethod("connectSerial")]
        bool connectSerial(int type, string port, bool reconnect);
        
        [XmlRpcBegin("connectSerial")]
        IAsyncResult BeginConnectSerial(int type, string port, bool reconnect, AsyncCallback acb);
        Then in your code you can do:
        Code:
        proxy.BeginConnectSerial((int)SerialType.RS232, "/dev/ttyS1", this.chkReconnect.Checked, this.SerialConnectCallback);
        --Mark
        Synapse Design Engineer

        Comment


        • #5
          Thanks Mark - works great. Is is possible to change the SnapConnect port on the E10?

          Comment

          Working...
          X