quickfast icon indicating copy to clipboard operation
quickfast copied to clipboard

Include template ID in the fast login message.

Open mounika-allagadda opened this issue 9 years ago • 0 comments

Hi,

I want to include template ID in the beginning of the fast encoded login message. I saw different examples to encode a message.

My code is as follows

  Messages::FieldIdentityCPtr identity_TemplateID = new Messages::FieldIdentity("TemplateID");
  Messages::FieldIdentityCPtr identity_MessageType = new Messages::FieldIdentity("MessageType");
  Messages::FieldIdentityCPtr identity_SendingTime = new Messages::FieldIdentity("SendingTime");
  Messages::FieldIdentityCPtr identity_AppID = new Messages::FieldIdentity("AppID");
  Messages::FieldIdentityCPtr identity_HeartBtInt = new Messages::FieldIdentity("HeartBtInt");
  Messages::FieldIdentityCPtr identity_Username = new Messages::FieldIdentity("Username");
  Messages::FieldIdentityCPtr identity_Password = new Messages::FieldIdentity("Password");

  Messages::MessagePtr logon_msg(new Messages::Message(templateRegistry_->maxFieldCount()));
  logon_msg->addField(identity_TemplateID, Messages::FieldUInt32::create(1));
  logon_msg->addField(identity_MessageType, Messages::FieldAscii::create("A"));
  logon_msg->addField(identity_SendingTime, Messages::FieldAscii::create(get_mit_time_stamp()));
  logon_msg->addField(identity_AppID, Messages::FieldUInt32::createNull());
  logon_msg->addField(identity_HeartBtInt, Messages::FieldUInt32::create(30));
  logon_msg->addField(identity_Username, Messages::FieldAscii::create(username));
  logon_msg->addField(identity_Password, Messages::FieldAscii::create(password));

  template_id_t templId = 1;

  BOOST_CHECKPOINT("encode logon_msg");
  QuickFAST::Codecs::DataDestinationString dest_logon;
  encoder_.encodeMessage(dest_logon, templId, *logon_msg);

The template is as follows:

     <template name="LogonHeader">
          <typeRef name="StandardHeader"/>
          <string name="MessageType" id="35"></string>
          <string name="SendingTime" id="52" presence="mandatory"><tail/></string>
    </template>

   <template name="Logon" id="1">
       <typeRef name="Logon"/>
       <templateRef name="LogonHeader"/>
       <string name="AppID" id="1180" presence="optional"></string>
       <uInt32 name="HeartBtInt" id="108" presence="mandatory"></uInt32> <!-- This should not be optional-->
       <string name="Username" id="553" presence="optional"></string>
       <string name="Password" id="554" presence="optional"></string>
   </template>

But in the encoded message, I dont think template ID will be there. Can someone please help me in including the template ID in the login message?

Thanks in Advance.

mounika-allagadda avatar Apr 20 '16 12:04 mounika-allagadda