How to use smlStatusCmd

Help
Zhiyong Ma
2008-06-03
2013-04-08
  • Zhiyong Ma
    Zhiyong Ma
    2008-06-03

    I test to use smlStatusCmd,but when server parses the document body,the error 200b is ouput.I don't know the reason although I tried many times.I use the syncml toolkit c 4.4. I'm not clear about how to fill SmlStatus_t, anybody help?

            SmlStatus_t  status;
        //memset(&status,0,sizeof(SmlStatus_t));

        SmlItem_t item;
        SmlItemList_t itemList;
        SmlSource_t source;
        SmlTarget_t target;

        /* smlResults cmd */
        status.elementType = SML_PE_STATUS;

        status.chal = 0;
        status.cmd = smlString2Pcdata("Add");
        status.cmdID = smlString2Pcdata("3456");
        status.cmdRef = smlString2Pcdata("9");
        status.cred = 0;
        status.msgRef = smlString2Pcdata("3456");

        status.data = smlString2Pcdata("status");

        SmlTargetRefList_t targetRefList;
        SmlSourceRefList_t sourceRefList;

        targetRefList.targetRef = smlString2Pcdata("./bruce1");
        targetRefList.next = 0;
        status.targetRefList = &targetRefList;

        sourceRefList.sourceRef = smlString2Pcdata("IMEI:001004FF1234567");
        sourceRefList.next = 0;
        status.sourceRefList = &sourceRefList;

        target.locURI = smlString2Pcdata("1");
        target.locName = smlString2Pcdata("Element ID at Target");
        item.target = ⌖

        source.locURI = smlString2Pcdata("2");
        source.locName = smlString2Pcdata("Element ID at Source");
        item.source = &source;

        item.data = smlString2Pcdata("200");
        item.meta = 0;

        itemList.item = &item;
        itemList.next = 0;

        status.itemList = &itemList;

        return smlStatusCmd(id, &status);

     
    • Marc van Eert
      Marc van Eert
      2008-06-05

      Try setting all the memberfields of the internal structures:

      SmlItemList_t itemListLang;

      itemLang.data = smlString2Pcdata("US-en");
      itemLang.meta = smlString2Pcdata(XML_FORMAT_PLAIN_TXT);
      itemLang.source = fillLocation(&sourceLang, "./DevInfo/Lang", NULL);
      itemLang.target = NULL;
      itemLang.flags = 0;

      Good luck