Table of Contents

ACDSN-AC-FX

The following line shows how to address and communicate with a NiX1 slave over a RS485 line.

 2700000000000000Qw3
 ^               ^^^
 |               |||
 |               ||- option
 |               |-- argument
 |               --- command
 ---- address

Addresses

Label Address Comment
scratch 270000000000005C This is the scratch address used to configure new slave
broadcast 27FFFFFFFFFFFF4E This is the broadcast address

Commands

Label Command
delete D
new N
query Q

Arguments

Delete

Label Arguments Options Comments
format a
delete file g <filename>
delete cron h
delete key k if option set to 0, delete file
delete right r <user>\t<unit> if option set to 0, delete file
restart s
delete unit u if option set to 0, delete file
delete user x if option set to 0, delete file
delete tmp files y delete file for Newfile fct

New

Label Arguments Options Comments
new bad access timeout b <timeout>
new valid access timeout c <timeout>
new entry e <comptability> count number of lines in ACCESS file, update log_position and set compatibility
new file g <filename>\t<CRC>
new cron h <cron>
copy file i <filename>/t<copyFilename>
new key k <timestamp>\t<key>
new lock l <1|2>\t<lock> locked (1) or not (0)
new mode m <mode> NiX1 enable/disable
new firmware version n <filename>\t<retry times>
new cron mode o  <cron mode>
new rights r <user>\t<unit>\t<right>
new general status s <value> set value in NiX general status
new timestamp t <timestamp>\t<TZ> only if RTC defined (used to synchronize clock)(date +%s)
new unit u <1|2>\t<unit>
new overdrive speed v <1|2>\t<overdrive> put 1-wire devices in overdrive speed
new user x <uid>\t<timestamp>\t<inc> timestamp of the last entry, and the key increment
new file packet y <nbrPacket>/t<blockLength>/t<CRC>/t<block>
new baudrate z <baudrate>

Query

Label Arguments Options Comments
query bad access timeout b
query valid access timeout c
query entry e Receive: <address> \t <uid> \t <unit> \t <key_timestamp> \t <timestamp> \t <timezone> \t <iop> \t <overdrive_speed> \t <status>
query file g <filename>\t<limit>
query cron h
query extension i <extension> give a list of files with the extension desired (TXT,1, …)
query secret key k
query lock l <1|2>
query mode m slave/device active or not
query firmware version n
query Cron Mode o
query Checksum p <filename>
query rights r <uid>\t<unit>
query general status s
query timestamp t only if RTC is defined
query unit u <1|2>
query overdrive speed v
query user x <uid>

Options

Options Comments
<block> block content (each char is formatted in 2 ascii in hexa value) ⇒ 'a' = 0x61 ⇒ sent : “61”
<blockLength> length of the actual block in bytes
<comptability> 0 to 65534 How many access we would like receive
<CRC> 16 bits value
<cron> * * * * *
<cron mode>  0 to 3
<filename> File on uSD: CONFIG.TXT, KEYS.TXT …
<inc> Key increment 0 to 99
<limit> Max line to display [0=all lines]
<mode> 0 [disable] or 1 [enable]
<nbrPacket> packet total number for a file
<overdrive> 0 [disable] or 1 [enable]
<recess> 0 to 180 [seconds]
<timeout> 0 to 255
<timestamp> 0 to 9'999'999'999 [seconds since 1.1.1970]
<TZ> -1200 to +1400
<uid>
<unit> 0 to 65534
CRON MODE

0) Do not use slave cron, DEFAULT
1) within the cron valid date, the door stay open
2) within the cron valid date, use key to unlock the door and then follow the cron date to close it
3) within the cron valid date, use key to unlock and lock the door

Return Code (HEX)

Code Transmission Functions
00 OK
04 EOT
06 ACK
15 NAK
16 SYN
21 ERROR_ADDRESS
41 ERROR_ARG
42 ERROR_BUS
43 ERROR_CMD ERROR_CREDENTIAL
44 ERROR_DATA (iC)
46 ERROR_FLASH
47 ERROR_CRC
48    ERROR_HASH
49 ERROR_IB
4B ERROR_KEY
4C ERROR_LOG
4D ERROR_MALLOC 
4E ERROR_NOT_FOUND
4F ERROR_OFFSET
50 ERROR_PARAM
51 ERROR_QUANTITY
52 ERROR_RXDATA
53 ERROR_STOPPED_MISSION (iC)
54 ERROR_TYPE
55 ERROR_USER
57 ERROR_WRITE
58 ERROR_X
60 ERROR_SYNTAX (used by/or no cron)
61 ERROR_DAY_OF_YEAR
63 ERROR_COPY
64 ERROR_NOBROADCAST
65 ERROR_EMPTY_MISSION (iC)
6C ERROR_LOCK
72 ERROR_RESOLUTION (sC)
73 ERROR_SCHEDULE
76 ERROR_UNIT
74 ERROR_TIMESTAMP
7B ERROR_SDCARDNOTFOUND
FF ERROR_INT

Configuration Files (Server)

The configuration files are flat text file where each fields are separated by a tabulation.

keys.txt

Contains the list of the key used to hash the credentials on the iButton key. You can generate a new key every day and add it to this file, the most recent key comming first.

Field Name Description Example
timestamp The timestamp of the time when the key has been generated 1350028169
key The value of the secret key [Z}4V;qr$(/Kc_aiF7#K8tATNC
demo_keys.txt
1350028169      [Z}4V;qr$(/Kc_aiF7#K8tATNC
1349094539      IdRPKslg\?/
1349085044      9YxUJ`wa#\U;M18=L,>_bo8wIbn"IoY
1349085044      cl8b]It3f,F-b
1349085044      ad15lMR{*]P_<koY&=@;cNgr

units.txt

Provides a link beetween the unit id and a human readable label.

Field Name Description Example
id The unique identifier of the unit, as used in slaves.conf 2
label A human description of the unit Main Office
demo_units.txt
1       Reception
2       Main Office
3       CEO's Office

users.txt

Contains the list of all users, the timestamp of the last key read from the user and a value which can be incremented when an iButton key is lost or if the data on the iButton key has been copied by some nasty people.

Field Name Description Example
id The unique identifier the the user, as used in cron.txt Arthur Dent
timestamp The timestamp of the last key read for the user 1350028169
increment A value which can be incremented when an iButton key is lost 3
demo_users.txt
Arthur Dent             1350028169      3
Ford Prefect            1349085044      2
Zaphod Beeblebrox       1349085044      5

cron.txt

Contains the rights to access on some unit for a user during a specified time interval (specified as a cron).

Field Name Description Example
unit_id The number identifying the target unit of this rule 1
user_id The identifier of the user on which this rule applies Arthur Dent
cron The cron value of the accessible periods for this rule 0 8-17 * * *
demo_cron.txt
1       Arthur Dent     0 8-17 * * *
2       Arthur Dent     0 8-17 * * *
1       Ford Prefect    * * * * *
CRON:	*     *     *   *    *
	-     -     -   -    -
	|     |     |   |    |
	|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
	|     |     |   +------- month (1 - 12)
	|     |     +--------- day of month (1 - 31)
	|     +----------- hour (0 - 23)
	+------------- min (0 - 59)

Configuration Files (Micro-SD)

These files can be found on the Micro-SD of a NiX.

#U.*

The # must be replaced by the humber of the unit. This file contains the rights to access on unit # for a user during a specified time interval (specified as a cron). (* Is the first letter of the uid)

Field Name Description Example
uid The identity of the user Arthur Dent
cron The cron value of the accessible periods for this unit 0 8-17 * * *
14U.U
user1	* * * * *
user2	* 7-19 * 1-8 1,4-5
user3	* * * * *
user4	* * * * *
15U.Y
YCPuvyf	        * * * * *
yScigNLowCBf	* * * * *
CRON:	*     *     *   *    *
	-     -     -   -    -
	|     |     |   |    |
	|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
	|     |     |   +------- month (1 - 12)
	|     |     +--------- day of month (1 - 31)
	|     +----------- hour (0 - 23)
	+------------- min (0 - 59)

ACCESS.#

This file contains important iButtons discharge logs. (# is the extension of day of year)

Field Name Description Example
slave address SID of NiX 271A2100000000F3
uid The identity of the user Arthur Dent
unit Unit identification 15
daily key timestamp The timestamp of daily key [0-1] 1400191201
timestamp The timestamp of the NiX 1400620011
timezone Code of the timezone +0100
probe On which probe was the interruption 1 or 2
overdrive speed Communication speed 0 or 1
error code Error code in hex format 39
ACCESS.#
271A2100000000F3	user1	15		1436413339	+0100	2	0	55
271A2100000000F3	user2	15		1436413340	+0100	2	0	55
271A2100000000F3	user1	9		1436413341	+0100	1	0	55
271A2100000000F3	user1	15		1436413345	+0100	2	0	55

ACTIVITY.#

This file contains not important iButtons discharge logs. (# is the extension of day of year)

First line:

Field Name Description Example
timestamp The timestamp of the time when the NiX start 1400578529
slave address SID of NiX 271A2100000000F3
general status Last general status of NiX before the start (in hex format) 00

After:

Field Name Description Example
slave address SID of NiX 271A2100000000F3
uid The identity of the user [0-1] Arthur Dent
unit Unit identification 15
daily key timestamp The timestamp of daily key [0-1] 1400191201
timestamp The timestamp of the NiX 1400620011
timezone Code of the timezone +0100
probe On which probe was the interruption 1 or 2
overdrive speed Communication speed 0 or 1
error code Error code in hex format 39
ACTIVITY.#
1436413328	Slave ID: 271A2100000000F3	General status: 00
271A2100000000F3		15		1436413338	+0100	2	0	49
271A2100000000F3		9		1436413339	+0100	1	0	49

CONFIG.TXT

This file contains the minimal configuration with which the NiX cans run autonomously.

CONFIG.TXT
BAD_ACCESS_TIMEOUT	5
BAUDRATE	9600
CRON	* 7-18 * * 1-5
ENABLE	1
LOCK_0		0
LOCK_1		0
OD_SPEED_0		1
OD_SPEED_1		1
STANDALONE	0
TIMEZONE	+0100
UNIT_0		14
UNIT_1		15
VALID_ACCESS_TIMEOUT	5

Mode: 0:INACTIVE, 1:NORMAL, 2:MOBILE 3:STANDALONE,

KEYS.TXT

This file contains the list of the key used by the NiX.

Field Name Description Example
timestamp The timestamp of the time when the key has been generated 1400191201
key The value of the secret key w`y]G+qmh{pNimx-0a,z#&.<%n
KEYS.TXT
1400191201	w`y]G+qmh{pNimx-0a,z#&.<%n
1400104801	xsL89*P&bn&I
1400018401	?u=QyySu)
1399932001	nD]XbDMfQ<TU6Pq
1399845601	hdUaP(W3"Jy!=i}ch1#h&yEw
1399759201	E5fZaw7"ihn#w!cDNL[fh6k
1399672801	W^HF#"4X7@O+uj1`I6`~&^'
1399586401	Wfb+@o^emSbfYt4J-x$eJ,PS
1399500001	MKSKVB7E7wBfDviD!IsV@uZ
1399413601	"cgBzm17'1iN7NrmkO&1"KcN4?
1399327201	~#9g$Z{{5\
1399240801	Ya,BY\NudPH"#WL#}
1399154401	_9/)bvW@L4)IP~
1399068001	7FZCB@.x_cY;^j!4!
1399047515	wt=U+$z&F=E}\$dLgA
1398981603	tOj|(mDpn`5Z!WS8r]V{Dkk|)
1398981602	tOj|(mDpn`5Z!WS8r]V{Dkk|)6q=NW<A
1398981601	o~ciZ<CwuB)8:VRlBHX%*C
1398895201	tOj|(mDpn`5Z!WS8r]V{Dkk|)6q=NW<C

USERS.*

(* Is the first letter of uid.)

Field Name Description Example
uid The identity of the user Arthur Dent
timestamp The timestamp of the last key read for the user 1350028169
increment A value which can be incremented when an iButton key is lost 3
USERS.Y
YCPuvyf	        772697	91
yScigNLowCBf	5081	38