1

Как получить все параметры объекта

Topic: Как получить все параметры объекта

Здравствуйте, вопрос вот в чём, можно ли с помощью запроса core/search_items получить все параметры объекта?
Пока вот что получается:

$params = [
    'spec' => [
        'itemsType' => 'avl_unit',
        'propName' => 'unit_sensors',
        'propValueMask' => '*',
        'sortType' => 'unit_sensors',
        'propType' => 'propitemname'
    ],
    'force' => 1,
    'flags' => 0x00100000,
    'from' => 0,
    'to' => 0
];

В ответ приходит:

{"searchSpec":{"itemsType":"avl_unit","propName":"unit_sensors","propValueMask":"*","sortType":"unit_sensors","propType":"propitemname","or_logic":"0"},"dataFlags":1048576,"totalItemsCount":4,"indexFrom":0,"indexTo":0,"items":[{"prms":{"adc1":{"v":0,"ct":1457592664,"at":1459263448},"form_state":{"v":"Position format: ASCII, Header prefix: @P, Time format: UNIX timestamp, Custom info: \"%SA%GQ%MV%BV%PC%MT\"\r","ct":1454488799,"at":1459248865},"gps_tm":{"v":1459263449,"ct":1459263448,"at":1459263448},"gsm":{"v":15,"ct":1459263442,"at":1459263448},"hdop":{"v":0.8,"ct":1459261896,"at":1459263448},"in":{"v":0,"ct":1454488762,"at":1459263448},"in1":{"v":0,"ct":1454488762,"at":1459263448},"in10":{"v":0,"ct":1454488762,"at":1459263448},"in11":{"v":0,"ct":1454488762,"at":1459263448},"in12":{"v":0,"ct":1454488762,"at":1459263448},"in13":{"v":0,"ct":1454488762,"at":1459263448},"in14":{"v":0,"ct":1454488762,"at":1459263448},"in15":{"v":0,"ct":1454488762,"at":1459263448},"in16":{"v":0,"ct":1454488762,"at":1459263448},"in17":{"v":0,"ct":1454488762,"at":1459263448},"in18":{"v":0,"ct":1454488762,"at":1459263448},"in19":{"v":0,"ct":1454488762,"at":1459263448},"in2":{"v":0,"ct":1454488762,"at":1459263448},"in20":{"v":0,"ct":1454488762,"at":1459263448},"in21":{"v":0,"ct":1454488762,"at":1459263448},"in22":{"v":0,"ct":1454488762,"at":1459263448},"in23":{"v":0,"ct":1454488762,"at":1459263448},"in24":{"v":0,"ct":1454488762,"at":1459263448},"in25":{"v":0,"ct":1454488762,"at":1459263448},"in26":{"v":0,"ct":1454488762,"at":1459263448},"in27":{"v":0,"ct":1454488762,"at":1459263448},"in28":{"v":0,"ct":1454488762,"at":1459263448},"in29":{"v":0,"ct":1454488762,"at":1459263448},"in3":{"v":0,"ct":1454488762,"at":1459263448},"in30":{"v":0,"ct":1454488762,"at":1459263448},"in31":{"v":0,"ct":1454488762,"at":1459263448},"in32":{"v":0,"ct":1454488762,"at":1459263448},"in4":{"v":0,"ct":1454488762,"at":1459263448},"in5":{"v":0,"ct":1454488762,"at":1459263448},"in6":{"v":0,"ct":1454488762,"at":1459263448},"in7":{"v":0,"ct":1454488762,"at":1459263448},"in8":{"v":0,"ct":1454488762,"at":1459263448},"in9":{"v":0,"ct":1454488762,"at":1459263448},"motion":{"v":1,"ct":1459263448,"at":1459263448},"odometer":{"v":50.7,"ct":1459252804,"at":1459263448},"out":{"v":0,"ct":1454488762,"at":1459263448},"out1":{"v":0,"ct":1454488762,"at":1459263448},"out10":{"v":0,"ct":1454488762,"at":1459263448},"out11":{"v":0,"ct":1454488762,"at":1459263448},"out12":{"v":0,"ct":1454488762,"at":1459263448},"out13":{"v":0,"ct":1454488762,"at":1459263448},"out14":{"v":0,"ct":1454488762,"at":1459263448},"out15":{"v":0,"ct":1454488762,"at":1459263448},"out16":{"v":0,"ct":1454488762,"at":1459263448},"out17":{"v":0,"ct":1454488762,"at":1459263448},"out18":{"v":0,"ct":1454488762,"at":1459263448},"out19":{"v":0,"ct":1454488762,"at":1459263448},"out2":{"v":0,"ct":1454488762,"at":1459263448},"out20":{"v":0,"ct":1454488762,"at":1459263448},"out21":{"v":0,"ct":1454488762,"at":1459263448},"out22":{"v":0,"ct":1454488762,"at":1459263448},"out23":{"v":0,"ct":1454488762,"at":1459263448},"out24":{"v":0,"ct":1454488762,"at":1459263448},"out25":{"v":0,"ct":1454488762,"at":1459263448},"out26":{"v":0,"ct":1454488762,"at":1459263448},"out27":{"v":0,"ct":1454488762,"at":1459263448},"out28":{"v":0,"ct":1454488762,"at":1459263448},"out29":{"v":0,"ct":1454488762,"at":1459263448},"out3":{"v":0,"ct":1454488762,"at":1459263448},"out30":{"v":0,"ct":1454488762,"at":1459263448},"out31":{"v":0,"ct":1454488762,"at":1459263448},"out32":{"v":0,"ct":1454488762,"at":1459263448},"out4":{"v":0,"ct":1454488762,"at":1459263448},"out5":{"v":0,"ct":1454488762,"at":1459263448},"out6":{"v":0,"ct":1454488762,"at":1459263448},"out7":{"v":0,"ct":1454488762,"at":1459263448},"out8":{"v":0,"ct":1454488762,"at":1459263448},"out9":{"v":0,"ct":1454488762,"at":1459263448},"posinfo":{"v":{"y":50.442361,"x":30.427809,"z":0,"c":80,"sc":10},"ct":1459263442,"at":1459263448},"prf":{"v":"@P","ct":1454488762,"at":1459263448},"pulse_count":{"v":0,"ct":1457592758,"at":1459263448},"pwr_ext":{"v":29.1,"ct":1459263442,"at":1459263448},"pwr_int":{"v":4.2,"ct":1457604695,"at":1459263448},"report_id":{"v":105,"ct":1459263448,"at":1459263448},"rtc_tm":{"v":1459263448,"ct":1459263448,"at":1459263448},"snd_tm":{"v":1459263448,"ct":1459263448,"at":1459263448},"speed":{"v":0,"ct":1459261330,"at":1459263448},"temp1":{"v":200,"ct":1454488762,"at":1459263448},"temp2":{"v":200,"ct":1454488762,"at":1459263448}}},{"prms":{"adc1":{"v":0.167,"ct":1459024460,"at":1459024760},"form_state":{"v":"Position format: Binary, Header prefix: @P, Time format: UNIX timestamp, Custom info: \"%SA%GQ%MV%BV%PC%MT\"\r","ct":1453885422,"at":1458998287},"gps_tm":{"v":1459024760,"ct":1459024760,"at":1459024760},"gsm":{"v":31,"ct":1459001339,"at":1459024760},"hdop":{"v":0.8,"ct":1459022960,"at":1459024760},"in":{"v":0,"ct":1459002622,"at":1459024760},"in1":{"v":0,"ct":1459002622,"at":1459024760},"in10":{"v":0,"ct":1453585321,"at":1459024760},"in11":{"v":0,"ct":1453585321,"at":1459024760},"in12":{"v":0,"ct":1453585321,"at":1459024760},"in13":{"v":0,"ct":1453585321,"at":1459024760},"in14":{"v":0,"ct":1453585321,"at":1459024760},"in15":{"v":0,"ct":1453585321,"at":1459024760},"in16":{"v":0,"ct":1453585321,"at":1459024760},"in17":{"v":0,"ct":1453585321,"at":1459024760},"in18":{"v":0,"ct":1453585321,"at":1459024760},"in19":{"v":0,"ct":1453585321,"at":1459024760},"in2":{"v":0,"ct":1453585321,"at":1459024760},"in20":{"v":0,"ct":1453585321,"at":1459024760},"in21":{"v":0,"ct":1453585321,"at":1459024760},"in22":{"v":0,"ct":1453585321,"at":1459024760},"in23":{"v":0,"ct":1453585321,"at":1459024760},"in24":{"v":0,"ct":1453585321,"at":1459024760},"in25":{"v":0,"ct":1453585321,"at":1459024760},"in26":{"v":0,"ct":1453585321,"at":1459024760},"in27":{"v":0,"ct":1453585321,"at":1459024760},"in28":{"v":0,"ct":1453585321,"at":1459024760},"in29":{"v":0,"ct":1453585321,"at":1459024760},"in3":{"v":0,"ct":1453585321,"at":1459024760},"in30":{"v":0,"ct":1453585321,"at":1459024760},"in31":{"v":0,"ct":1453585321,"at":1459024760},"in32":{"v":0,"ct":1453585321,"at":1459024760},"in4":{"v":0,"ct":1457591590,"at":1459024760},"in5":{"v":0,"ct":1453585321,"at":1459024760},"in6":{"v":0,"ct":1453585321,"at":1459024760},"in7":{"v":0,"ct":1453585321,"at":1459024760},"in8":{"v":0,"ct":1453585321,"at":1459024760},"in9":{"v":0,"ct":1453585321,"at":1459024760},"motion":{"v":0,"ct":1459001387,"at":1459024760},"odometer":{"v":17168,"ct":1459001360,"at":1459024760},"out":{"v":0,"ct":1453585321,"at":1459024760},"out1":{"v":0,"ct":1453585321,"at":1459024760},"out10":{"v":0,"ct":1453585321,"at":1459024760},"out11":{"v":0,"ct":1453585321,"at":1459024760},"out12":{"v":0,"ct":1453585321,"at":1459024760},"out13":{"v":0,"ct":1453585321,"at":1459024760},"out14":{"v":0,"ct":1453585321,"at":1459024760},"out15":{"v":0,"ct":1453585321,"at":1459024760},"out16":{"v":0,"ct":1453585321,"at":1459024760},"out17":{"v":0,"ct":1453585321,"at":1459024760},"out18":{"v":0,"ct":1453585321,"at":1459024760},"out19":{"v":0,"ct":1453585321,"at":1459024760},"out2":{"v":0,"ct":1453585321,"at":1459024760},"out20":{"v":0,"ct":1453585321,"at":1459024760},"out21":{"v":0,"ct":1453585321,"at":1459024760},"out22":{"v":0,"ct":1453585321,"at":1459024760},"out23":{"v":0,"ct":1453585321,"at":1459024760},"out24":{"v":0,"ct":1453585321,"at":1459024760},"out25":{"v":0,"ct":1453585321,"at":1459024760},"out26":{"v":0,"ct":1453585321,"at":1459024760},"out27":{"v":0,"ct":1453585321,"at":1459024760},"out28":{"v":0,"ct":1453585321,"at":1459024760},"out29":{"v":0,"ct":1453585321,"at":1459024760},"out3":{"v":0,"ct":1453585321,"at":1459024760},"out30":{"v":0,"ct":1453585321,"at":1459024760},"out31":{"v":0,"ct":1453585321,"at":1459024760},"out32":{"v":0,"ct":1453585321,"at":1459024760},"out4":{"v":0,"ct":1453585321,"at":1459024760},"out5":{"v":0,"ct":1453585321,"at":1459024760},"out6":{"v":0,"ct":1453585321,"at":1459024760},"out7":{"v":0,"ct":1453585321,"at":1459024760},"out8":{"v":0,"ct":1453585321,"at":1459024760},"out9":{"v":0,"ct":1453585321,"at":1459024760},"posinfo":{"v":{"y":50.510756,"x":30.810753,"z":0,"c":193,"sc":10},"ct":1459023860,"at":1459024760},"prf":{"v":"0x4050","ct":1453585321,"at":1459024760},"pulse_count":{"v":5475,"ct":1459001660,"at":1459024760},"pwr_ext":{"v":0,"ct":1459002860,"at":1459024760},"pwr_int":{"v":3.5,"ct":1459024160,"at":1459024760},"report_id":{"v":2,"ct":1459002860,"at":1459024760},"rtc_tm":{"v":1459024760,"ct":1459024760,"at":1459024760},"snd_tm":{"v":1459024760,"ct":1459024760,"at":1459024760},"speed":{"v":0,"ct":1459001660,"at":1459024760},"temp1":{"v":200,"ct":1453585321,"at":1459024760},"temp2":{"v":200,"ct":1453585321,"at":1459024760}}},{"prms":{"adc1":{"v":0,"ct":1455358449,"at":1459263184},"form_state":{"v":"Position format: Binary, Header prefix: @P, Time format: UNIX timestamp, Custom info: \"%SA%GQ%MV%BV%PC%MT\"\r","ct":1454024127,"at":1459249920},"gps_tm":{"v":1459263184,"ct":1459263184,"at":1459263184},"gsm":{"v":16,"ct":1459263184,"at":1459263184},"hdop":{"v":0.7,"ct":1459263184,"at":1459263184},"in":{"v":0,"ct":1453858925,"at":1459263184},"in1":{"v":0,"ct":1453858925,"at":1459263184},"in10":{"v":0,"ct":1453858925,"at":1459263184},"in11":{"v":0,"ct":1453858925,"at":1459263184},"in12":{"v":0,"ct":1453858925,"at":1459263184},"in13":{"v":0,"ct":1453858925,"at":1459263184},"in14":{"v":0,"ct":1453858925,"at":1459263184},"in15":{"v":0,"ct":1453858925,"at":1459263184},"in16":{"v":0,"ct":1453858925,"at":1459263184},"in17":{"v":0,"ct":1453858925,"at":1459263184},"in18":{"v":0,"ct":1453858925,"at":1459263184},"in19":{"v":0,"ct":1453858925,"at":1459263184},"in2":{"v":0,"ct":1453858925,"at":1459263184},"in20":{"v":0,"ct":1453858925,"at":1459263184},"in21":{"v":0,"ct":1453858925,"at":1459263184},"in22":{"v":0,"ct":1453858925,"at":1459263184},"in23":{"v":0,"ct":1453858925,"at":1459263184},"in24":{"v":0,"ct":1453858925,"at":1459263184},"in25":{"v":0,"ct":1453858925,"at":1459263184},"in26":{"v":0,"ct":1453858925,"at":1459263184},"in27":{"v":0,"ct":1453858925,"at":1459263184},"in28":{"v":0,"ct":1453858925,"at":1459263184},"in29":{"v":0,"ct":1453858925,"at":1459263184},"in3":{"v":0,"ct":1453858925,"at":1459263184},"in30":{"v":0,"ct":1453858925,"at":1459263184},"in31":{"v":0,"ct":1453858925,"at":1459263184},"in32":{"v":0,"ct":1453858925,"at":1459263184},"in4":{"v":0,"ct":1453858925,"at":1459263184},"in5":{"v":0,"ct":1453858925,"at":1459263184},"in6":{"v":0,"ct":1453858925,"at":1459263184},"in7":{"v":0,"ct":1453858925,"at":1459263184},"in8":{"v":0,"ct":1453858925,"at":1459263184},"in9":{"v":0,"ct":1453858925,"at":1459263184},"motion":{"v":1,"ct":1459261816,"at":1459263184},"odometer":{"v":542.3,"ct":1459260484,"at":1459263184},"out":{"v":0,"ct":1453858925,"at":1459263184},"out1":{"v":0,"ct":1453858925,"at":1459263184},"out10":{"v":0,"ct":1453858925,"at":1459263184},"out11":{"v":0,"ct":1453858925,"at":1459263184},"out12":{"v":0,"ct":1453858925,"at":1459263184},"out13":{"v":0,"ct":1453858925,"at":1459263184},"out14":{"v":0,"ct":1453858925,"at":1459263184},"out15":{"v":0,"ct":1453858925,"at":1459263184},"out16":{"v":0,"ct":1453858925,"at":1459263184},"out17":{"v":0,"ct":1453858925,"at":1459263184},"out18":{"v":0,"ct":1453858925,"at":1459263184},"out19":{"v":0,"ct":1453858925,"at":1459263184},"out2":{"v":0,"ct":1453858925,"at":1459263184},"out20":{"v":0,"ct":1453858925,"at":1459263184},"out21":{"v":0,"ct":1453858925,"at":1459263184},"out22":{"v":0,"ct":1453858925,"at":1459263184},"out23":{"v":0,"ct":1453858925,"at":1459263184},"out24":{"v":0,"ct":1453858925,"at":1459263184},"out25":{"v":0,"ct":1453858925,"at":1459263184},"out26":{"v":0,"ct":1453858925,"at":1459263184},"out27":{"v":0,"ct":1453858925,"at":1459263184},"out28":{"v":0,"ct":1453858925,"at":1459263184},"out29":{"v":0,"ct":1453858925,"at":1459263184},"out3":{"v":0,"ct":1453858925,"at":1459263184},"out30":{"v":0,"ct":1453858925,"at":1459263184},"out31":{"v":0,"ct":1453858925,"at":1459263184},"out32":{"v":0,"ct":1453858925,"at":1459263184},"out4":{"v":0,"ct":1453858925,"at":1459263184},"out5":{"v":0,"ct":1453858925,"at":1459263184},"out6":{"v":0,"ct":1453858925,"at":1459263184},"out7":{"v":0,"ct":1453858925,"at":1459263184},"out8":{"v":0,"ct":1453858925,"at":1459263184},"out9":{"v":0,"ct":1453858925,"at":1459263184},"posinfo":{"v":{"y":50.496605,"x":30.426336,"z":0,"c":44,"sc":11},"ct":1459263184,"at":1459263184},"prf":{"v":"0x4050","ct":1453858925,"at":1459263184},"pulse_count":{"v":2401651,"ct":1458033284,"at":1459263184},"pwr_ext":{"v":29.1,"ct":1459263184,"at":1459263184},"pwr_int":{"v":4.2,"ct":1458884882,"at":1459263184},"report_id":{"v":2,"ct":1459261984,"at":1459263184},"rtc_tm":{"v":1459263184,"ct":1459263184,"at":1459263184},"snd_tm":{"v":1459263184,"ct":1459263184,"at":1459263184},"speed":{"v":0,"ct":1459263184,"at":1459263184},"temp1":{"v":200,"ct":1453858925,"at":1459263184},"temp2":{"v":200,"ct":1453858925,"at":1459263184}}},{"prms":{"battery_charge":{"v":0,"ct":1459257294,"at":1459263363},"gsm":{"v":5,"ct":1459257562,"at":1459263363},"in":{"v":0,"ct":1459257425,"at":1459263363},"in1":{"v":0,"ct":1459257425,"at":1459263363},"in10":{"v":0,"ct":1458643387,"at":1459263363},"in11":{"v":0,"ct":1458643387,"at":1459263363},"in12":{"v":0,"ct":1458643387,"at":1459263363},"in13":{"v":0,"ct":1458643387,"at":1459263363},"in14":{"v":0,"ct":1458643387,"at":1459263363},"in15":{"v":0,"ct":1458643387,"at":1459263363},"in16":{"v":0,"ct":1458643387,"at":1459263363},"in17":{"v":0,"ct":1458643387,"at":1459263363},"in18":{"v":0,"ct":1458643387,"at":1459263363},"in19":{"v":0,"ct":1458643387,"at":1459263363},"in2":{"v":0,"ct":1458643387,"at":1459263363},"in20":{"v":0,"ct":1458643387,"at":1459263363},"in21":{"v":0,"ct":1458643387,"at":1459263363},"in22":{"v":0,"ct":1458643387,"at":1459263363},"in23":{"v":0,"ct":1458643387,"at":1459263363},"in24":{"v":0,"ct":1458643387,"at":1459263363},"in25":{"v":0,"ct":1458643387,"at":1459263363},"in26":{"v":0,"ct":1458643387,"at":1459263363},"in27":{"v":0,"ct":1458643387,"at":1459263363},"in28":{"v":0,"ct":1458643387,"at":1459263363},"in29":{"v":0,"ct":1458643387,"at":1459263363},"in3":{"v":0,"ct":1459257425,"at":1459263363},"in30":{"v":0,"ct":1458643387,"at":1459263363},"in31":{"v":0,"ct":1458643387,"at":1459263363},"in32":{"v":0,"ct":1458643387,"at":1459263363},"in4":{"v":0,"ct":1458643387,"at":1459263363},"in5":{"v":0,"ct":1458643387,"at":1459263363},"in6":{"v":0,"ct":1458643387,"at":1459263363},"in7":{"v":0,"ct":1458643387,"at":1459263363},"in8":{"v":0,"ct":1458643387,"at":1459263363},"in9":{"v":0,"ct":1458643387,"at":1459263363},"param100":{"v":0,"ct":1458643387,"at":1459263363},"param101":{"v":0,"ct":1458643387,"at":1459263363},"param102":{"v":179,"ct":1458643387,"at":1459263363},"param103":{"v":179,"ct":1458643387,"at":1459263363},"param112":{"v":0,"ct":1458643387,"at":1459263363},"param113":{"v":0,"ct":1458643387,"at":1459263363},"param155":{"v":0,"ct":1459257448,"at":1459263363},"param158":{"v":63,"ct":1459257384,"at":1459263363},"param159":{"v":1,"ct":1458643387,"at":1459263363},"param240":{"v":0,"ct":1459259662,"at":1459263363},"param6":{"v":0,"ct":1459257464,"at":1459263363},"posinfo":{"v":{"y":50.4286183,"x":30.5111716,"z":92,"c":0,"sc":9},"ct":1459262963,"at":1459263363},"pwr_ext":{"v":0.002,"ct":1459263363,"at":1459263363},"pwr_int":{"v":3.691,"ct":1459263363,"at":1459263363},"speed":{"v":0,"ct":1458644386,"at":1459263363},"text":{"v":"CMD_ANS, PACKET_TYPE: 37, PARAM_ID: 364, RES: 255","ct":1459252861,"at":1459252861}}}]}

А хотелось бы что-то типо:

{"prms":{"adc1","form_state" и тд.}

Буду весь благодарен smile

2

Как получить все параметры объекта

Re: Как получить все параметры объекта

Добрый день

Вы ведь их уже получили, осталось только пробежаться и собрать в массив или сделать что-то вроде

array_keys($item['prms']) // получить ключи массива prms

PS на каком языке программируете? извиняюсь, сходу не признал PHP)

3

Как получить все параметры объекта

Re: Как получить все параметры объекта

shmi php, я то могу собрать в массив и все дела, просто месяц назад видел на форуме решение на мой вопрос, а сейчас найти не могу, вот думал, может кто-то поможет. Не сильно хочу функцию грузить перебором массива.

4

Как получить все параметры объекта

Re: Как получить все параметры объекта

hesoy
Не припоминаю такой темы..
Уточните, пожалуйста, что вам надо получить? В примере вы получаете параметры, когда-либо приходившие в сообщениях объекта. Оно и требуется?

5

Как получить все параметры объекта

Re: Как получить все параметры объекта

shmi надо получить массив параметров, доступных для объекта, типо:

{"prms":{"adc1","form_state","gps_tm","hdop" и тд}

Если это нереально или еще что, то тогда не утруждайтесь, сделаю перебор, просто видел где-то и интересно стало, не приснилось ли или может попутал что-то)))

6

Как получить все параметры объекта

Re: Как получить все параметры объекта

shmi выполнил такой же запрос, но на WialonPro

$params = [
    'spec' => [
        'itemsType' => 'avl_unit',
        'propName' => 'unit_sensors',
        'propValueMask' => '*',
        'sortType' => 'unit_sensors',
        'propType' => 'propitemname'
    ],
    'force' => 1,
    'flags' => 0x00100000,
    'from' => 0,
    'to' => 0
];

и он ничего не вернул, такой запрос не предусмотрен в Pro версии?

7

Как получить все параметры объекта

Re: Как получить все параметры объекта

В Pro такого функционала нет

8

Как получить все параметры объекта

Re: Как получить все параметры объекта

Здравствуйте, для создания аппсов на платформе wialon, только с ajax-ом могу получить параметры? Или есть еще варианты. И если можно пожалуйста дайте мне один экзампл для представление, о чем идет речь.