ID_check()

ID_check()

Description

Checks if device ID exists inside a list.

Syntax

ID_check(index, arg1, arg2);

Parameters

Variable

Input

Variable

Input

index

Index of ID list. Values from 1 to 255.

arg1

64bit identifier 32 lower bits.

arg2

64bit identifier 32 higher bits.

Returns

Return value

Return explanation

SCRIPT_OPERATION_SUCCESS

ID was found

SCRIPT_OPERATION_FAILED

ID was not found

SCRIPT_PARAM_INVALID

ID index is out of bounds.

Function call example

When ID is presented via 1-wire reader, script will enter callback

#define NUMBER_OF_ID_LISTS 10 new str_temp[255]; forward public callback(event); forward check_id_lists(high_bits, low_bits); public callback(event) { switch(event) { case Ibutton_ID: { check_id_lists(get_val(SENSOR_IBUTTON_ID, Bit64_high), get_val(SENSOR_IBUTTON_ID, Bit64_low)); } } return 0; } main() { Init(RS232, 115200, WORDLENGTH_8, STOPBITS_1, PARITY_NONE); Init(Ibutton_ID); for(;;) { Delay(1000); } } check_id_lists(high_bits, low_bits) { for(new i = 0; i < NUMBER_OF_ID_LISTS; i++) { if(ID_check(i, low_bits, high_bits)) { snprintf(str_temp, sizeof(str_temp), "Received ID (%08X%08X) belongs to %i list.\r\n", high_bits, low_bits, i); write_buf(RS232, strlen(str_temp), str_temp); } } }

Used in Examples

ID list check