🗺️ Zones — Bulk geofence catalogue
Classic geofences (RG and WP) are configured one at a time and top out at 32 of each kind. When you need to watch hundreds of customers, depots or restricted areas, that is not enough.
The zones module solves that case: geofences are defined once in a file, the device downloads it with a single command, and updating them is a matter of replacing the file.
It supports up to 4096 geometries grouped into up to 512 logical zones.
Concepts
| Concept | What it is |
|---|---|
| Element | A geometry: a point with a radius, a polygon, or a route with a width |
| Logical zone | The “channel” rules see: ZNA00–ZNA99 and ZNB00–ZNB99. The number is decimal: ZNA42 is zone 42 |
| Membership | Each element declares which zones it feeds. Several elements can feed the same zone, and one element can belong to several |
| Zones file | The compiled binary the device downloads and evaluates |
Geometry types
| Type | How it is detected | Typical use |
|---|---|---|
| Point | Distance to the centre within the radius | Depots, customers, fuel stations |
| Polygon | The position falls inside the outline | Urban areas, restricted zones |
| Route | Distance to the line within the width | Corridors, motorway stretches |
Several elements can feed the same zone. The zone stays “inside” while the device is within any of them. Useful to group, say, all of a customer’s branches into a single zone.
The device evaluates the position against the whole catalogue once per second. The cost does not depend on the file size but on how many geometries are nearby: a large catalogue does not make it slower.
Getting started
Reserve memory
Zones share memory with the internal log, so a portion has to be set aside first:
>SZFRAC8< reserves one eighth
>SZMODE1< enables zone modeThe device restarts to apply it, and requires the log to be empty. See ZONES Command.
Download the catalogue
>SZONES"http://…/zones.bin"<The device downloads the file, validates it and makes it live. A download is cancelled with >SZONESC< and the catalogue is erased with >SZONESD<.
Verify
>QZONES< → RZONES,LOADED,ver=…,crc=…,elem=…,size=…elem tells you how many geometries were loaded: that is the confirmation the file came through complete.
Define what gets reported
Zones do not report on their own. You have to say what to do on entry or exit, using rules.
Reporting entries and exits
A zone is just another signal for the rules engine:
>SRL10E;TRG=ZNA00+;ACC={GCP01H}<| Edge | Fires on |
|---|---|
+ | entering the zone |
- | leaving the zone |
* | any change |
Examples:
>SRL10E;TRG=ZNA00+;ACC={GCP01H}<
on entering zone 0 → high-priority report
>SRL11E;TRG=ZNA00-;CND=GPS;ACC={GCP02H}<
on leaving, only with a valid fix → report
>SRL12E;TRG=ZNB10*;ACC={GTX00L;@SM0;TXT=ZONE CHANGE}<
any change in the zone → SMS alertThey combine with any other signal: ignition, inputs, speed, schedules.
Checking a zone’s state
>EVAL ZNA(0):%d< → 1 = inside, 0 = outside
>QSSZNA00< → RSSZNA0011 = inside, RSSZNA0000 = outsideWhat to know beforehand
If the GPS fix is lost, every zone goes to “outside” and fires its exit edge. If an exit triggers something critical — cutting, alerting, blocking — guard it with CND=GPS so it only acts with a valid position.
Rules use zones 00 to 99 of each group, not all 512, and the number is decimal: ZNA42 is zone 42. That is also the only range you can query with >QSSZNA42<, which requires two digits.
The rule index is read with the same dual scheme as the RL slot, so the firmware also accepts A0–FF (zones 100 to 195, hex of the index plus 0x3C). It is a valid range but easy to misread —ZNAA0 is not zone 160, it is zone 100— and it cannot be queried by command, so it is best avoided.
The remaining zones still work as geofences and are read with EVAL ZNA(n), whose index is decimal from 0 to 255. When building a large catalogue, keep the zones that trigger rules within 0–99.
- There is no automatic report: the module emits nothing by itself. Everything reported is defined through rules, which gives full control over which zones speak up and how.
- Detection takes up to one second, which is the rate at which the catalogue is evaluated.
Limits
| Geometries per file | 4096 |
| Logical zones | 512 (ZNA 0–255 · ZNB 256–511) |
| Usable in rules and queries | 0–99 of each group (decimal index) |
| Rest of the catalogue | Geofence and EVAL ZNA(n) / ZNB(n), decimal index 0–255 |
| Evaluation | Once per second |
See also
- ZONES Command — download, erase and memory reservation
- RL Command — rules engine
- EVAL Command — state queries