示例#1
0
EIP_STATUS CIP_Identity_Init()
  {
    S_CIP_Class *pClass;
    S_CIP_Instance *pInstance;

    pClass = createCIPClass(CIP_IDENTITY_CLASS_CODE, 0, /* # of non-default class attributes*/
        MASK4(1, 2, 6, 7), /* class getAttributeAll mask		CIP spec 5-2.3.2*/
        0, /* # of class services*/
        7, /* # of instance attributes*/
        MASK7(1, 2, 3, 4, 5, 6, 7), /* instance getAttributeAll mask	CIP spec 5-2.3.2*/
        1, /* # of instance services*/
        1, /* # of instances*/
        "identity", /* class name (for debug)*/
        1); /* class revision*/

    if (pClass == 0)
      return EIP_ERROR;

    pInstance = getCIPInstance(pClass, 1);

    insertAttribute(pInstance, 1, CIP_UINT, &VendorID, CIP_ATTRIB_GETABLE);
    insertAttribute(pInstance, 2, CIP_UINT, &DeviceType, CIP_ATTRIB_GETABLE);
    insertAttribute(pInstance, 3, CIP_UINT, &ProductCode, CIP_ATTRIB_GETABLE);
    insertAttribute(pInstance, 4, CIP_USINT_USINT, &Revison, CIP_ATTRIB_GETABLE);
    insertAttribute(pInstance, 5, CIP_WORD, &ID_Status, CIP_ATTRIB_GETABLE);
    insertAttribute(pInstance, 6, CIP_UDINT, &SerialNumber, CIP_ATTRIB_GETABLE);
    insertAttribute(pInstance, 7, CIP_SHORT_STRING, &ProductName, CIP_ATTRIB_GETABLE);

    insertService(pClass, CIP_RESET, &Reset, "Reset");

    return EIP_OK;
  }
示例#2
0
      message_router_response->general_status = kCipErrorInvalidParameter;
    } else {
      /* eip_status = EIP_OK; */
    }
  }
  message_router_response->data_length = 0;
  return eip_status;
}

EipStatus CipIdentityInit() {

  CipClass *class = CreateCipClass(kIdentityClassCode, 0, /* # of non-default class attributes */
                         MASK4(1, 2, 6, 7), /* class getAttributeAll mask		CIP spec 5-2.3.2 */
                         0, /* # of class services*/
                         7, /* # of instance attributes*/
                         MASK7(1, 2, 3, 4, 5, 6, 7), /* instance getAttributeAll mask	CIP spec 5-2.3.2 */
                         1, /* # of instance services*/
                         1, /* # of instances*/
                         "identity", /* class name (for debug)*/
                         1); /* class revision*/

  if (class == 0)
    return kEipStatusError;

  CipInstance *instance = GetCipInstance(class, 1);

  InsertAttribute(instance, 1, kCipUint, &vendor_id_, kGetableSingleAndAll);
  InsertAttribute(instance, 2, kCipUint, &device_type_, kGetableSingleAndAll);
  InsertAttribute(instance, 3, kCipUint, &product_code_, kGetableSingleAndAll);
  InsertAttribute(instance, 4, kCipUsintUsint, &revision_,
                  kGetableSingleAndAll);