1

How to get a plate number using JS API?

(edited by gly2008 11/11/2019 10:41:58)

Topic: How to get a plate number using JS API?

Hi,
I looked through the forum but don't know yet how to get this data. The part of my code:

showObjects(){
      const searchSpec = {
        itemsType:"avl_unit",
        propName: "sys_name",
        propValueMask: "*",   
        sortType: "!sys_id",
      };
      const dataFlags = wialon.item.Item.dataFlag.base |
                      wialon.item.Unit.dataFlag.sensors |
                      wialon.item.Unit.dataFlag.lastMessage |
                      wialon.item.Unit.dataFlag.customProps |
                      wialon.item.Unit.dataFlag.messageParams

      session.searchItems(searchSpec, true, dataFlags, 0, 0, (code, data) => {
        if (code) {
          this.showMessage(`Error ${code} - ${wialon.core.Errors.getErrorText(code)}`);
          return;
        }
        console.log(data);
.......
I load the following libraries:
      session.loadLibrary("itemIcon");
      session.loadLibrary("unitSensors");
      session.loadLibrary("unitEvents");
      session.loadLibrary("itemCustomFields");
      session.loadLibrary("itemProfileFields");
What should I add?

2

How to get a plate number using JS API?

Re: How to get a plate number using JS API?

Plate number is a profile field, try to add wialon.item.Item.dataFlag.profileFields, then find field with name "registration_plate" in the item.getProfileFields().

3

How to get a plate number using JS API?

Re: How to get a plate number using JS API?

rual
I got it, thanks a lot!