Post

2 followers Follow
0
Avatar

Reset LonWorks Adapter/ Switch adapter to configured

Hello,

I am looking for the message structure that I can send through C code that switches the adapter (U10/U20 USB Netwerok Interface) status from Un-configured status to configured or at least reset the device to its initial configuration.

Thanks,
John

John Jacoub

Official comment

Avatar

Hi John

You need to send an Set Node Mode message, code 0x6C
Please see the declaration below:
typedef struct {
enum {
appl_offline = 0, // soft offline state
appl_online = 1,
appl_reset = 2,
change_state = 3,
} mode;
enum {
appl_uncnfg = 2,
no_appl_uncnfg = 3,
cnfg_online = 4,
cnfg_offline = 6, // hard offline state
} node_state; // Optional field if mode = 3
} NM_set_node_mode_request;

Karelle Perrault
Comment actions Permalink

Please sign in to leave a comment.

4 comments

0
Avatar

Hello Karelle,

Thank you for your reply!

I have tried the following:

   typedef struct {
          enum {
                 appl_offline = 0, // soft offline state
                 appl_online = 1,
                 appl_reset = 2,
                 change_state = 3,
          } mode;
          enum {
                 appl_uncnfg = 2,
                 no_appl_uncnfg = 3,
                 cnfg_online = 4,
                 cnfg_offline = 6, // hard offline state
          } node_state; // Optional field if mode = 3
   } NM_set_node_mode_request;


   NM_set_node_mode_request noderequest;
   noderequest.mode =2;
   noderequest.node_state = 4;

   memcpy(&m_msgOut.data.exp.code, (MsgData*)&noderequest, sizeof(noderequest));

And also

   NM_set_node_mode_request noderequest;
   noderequest.mode =2;
   noderequest.node_state = 4;

memcpy(&m_msgOut.data.exp.data, (MsgData*)&noderequest, sizeof(noderequest));
   m_msgOut.data.exp.code = 0x6c;

int dc = ldv_write(sConnectionHandler, &m_msgOut, sizeof(m_msgOut));

But none of them has reset the device. Are there other parameters are required to be set in the message?

Thanks,
John
PS: Sorry of you get this reply via your email. I was not sure if we respond through the email or on the online form

John Jacoub 0 votes
Comment actions Permalink
0
Avatar

What I am trying to do is the following:

In our application, LonWorks is used by two software and our application switches between the softwares. One software turns the node to hard offline by sending the message {6C, 03, 06}. When the second software (the one I develop) tries to access the node, it is in the offline state so no responses.

I have tried to pushed the message {6c, 03, 04} to switch it back online. But the device does not respond when I send the message. I simply open the connection and then push the message through.

typedef struct {
    Byte code;
    enum {
        appl_offline = 0, // soft offline state
        appl_online = 1,
        appl_reset = 2,
        change_state = 3,
    } mode;
    enum {
        appl_uncnfg = 2,
        no_appl_uncnfg = 3,
        cnfg_online = 4,
        cnfg_offline = 6, // hard offline state
    } node_state;
    // Optional field if mode = 3
} NM_set_node_mode_request;

NM_set_node_mode_request noderequest;

noderequest.code = 0x6C;
noderequest.mode = 3;
noderequest.node_state = 4;
int length = sizeof(noderequest);
memcpy(&m_msgOut.data.exp.code, (MsgData*)&noderequest, length);

static const NI_Queue queue[2][2] =         // define network interface queue
{
    {
        niTQ, niTQ_P
    },
    {
        niNTQ, niNTQ_P
    }
};
m_msgOut.ni_hdr.q.queue = queue[0][0];
m_msgOut.ni_hdr.q.q_cmd = niNETMGMT;
m_msgOut.ni_hdr.q.length = sizeof(ExpMsgHdr)+sizeof(ExplicitAddr)+length;    // Header size
m_msgOut.msg_hdr.exp.tag = 15;
m_msgOut.msg_hdr.exp.auth = 0;
m_msgOut.msg_hdr.exp.st = 3; //Set the message type to be Request
m_msgOut.msg_hdr.exp.msg_type = 0;              // the interface doesn't process NVs
m_msgOut.msg_hdr.exp.response = 0;              // Not a response message
m_msgOut.msg_hdr.exp.pool = 0;              // Must be zero
m_msgOut.msg_hdr.exp.alt_path = 0;              // Use default path
m_msgOut.msg_hdr.exp.addr_mode = 127;  // Addressing mode
m_msgOut.msg_hdr.exp.cmpl_code = MSG_NOT_COMPL;  // Zero
m_msgOut.msg_hdr.exp.path = 0;              // Use primary path
m_msgOut.msg_hdr.exp.priority = 0;  //The message is marked as low priority
m_msgOut.msg_hdr.exp.length = sizeof(noderequest);        // Message size
int dc = ldv_write(sConnectionHandler, &m_msgOut, 257);
John Jacoub 0 votes
Comment actions Permalink
0
Avatar

do I need to execute any other commands before I send the configuration command? such as get status? or reset?

John Jacoub 0 votes
Comment actions Permalink