<?xml version="1.0" encoding="utf-8"?>
<Templates xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://gpsgate.com/xml/">
  <Template type="ApplicationEntity">
    <Object>
      <TemplateGuid>cb6835ff-1c15-481f-bc6b-44b224b952dd</TemplateGuid>
      <TemplateVersion>10</TemplateVersion>
      <ObjectType>GpsGate.Online.Scripting.ScriptApp</ObjectType>
      <ObjectData>
        <Name>No Entry Area Alarm</Name>
        <ClickScripts>
          <ClickScriptRef UsedInRoles="f3f977f4-266b-46bd-a3f3-e1e4aba1ab68 1a87c0ae-bc80-4ed8-a0eb-469767145b85 b72d758e-05f7-4f75-94c9-62c55ae3f49b">ca5d5cd4-ee57-44fa-a644-e5e1236d0d24</ClickScriptRef>
        </ClickScripts>
        <Roles>
          <RoleRef>b72d758e-05f7-4f75-94c9-62c55ae3f49b</RoleRef>
        </Roles>
        <ExplicitRefs />
        <WebServiceScripts />
      </ObjectData>
    </Object>
    <Object>
      <TemplateGuid>ca5d5cd4-ee57-44fa-a644-e5e1236d0d24</TemplateGuid>
      <TemplateVersion>10</TemplateVersion>
      <ObjectType>GpsGate.Online.Scripting.NotifierClickScript</ObjectType>
      <ObjectData>
        <Name>No Entry</Name>
        <Disabled>false</Disabled>
        <Script>// Script for Notifier actions.



var geofence_group = 'No Entry Route';
var geofence_group_alarm = 'No Entry Route Alarm';



var new_geo_id = Number(context.resolve('[NEW_GEOFENCE_ID]'));

var old_geo_id = Number(context.resolve('[OLD_GEOFENCE_ID]'));

log('New Geo' + new_geo_id)
log('Old Geo' + old_geo_id)

if (!isNaN(new_geo_id) &amp;&amp; new_geo_id &gt;0) {

      geofences.updateGroup(geofence_group_alarm,[new_geo_id],[]);
      log('Change new geo to new group')
  
}
if (!isNaN(old_geo_id) &amp;&amp; old_geo_id &gt;0) {

      geofences.updateGroup(geofence_group_alarm,[],[old_geo_id]);  
        log('remove old from group')
    
}

log("OK");</Script>
        <EventRuleRef>bae7352b-1997-4f2e-afc1-6f48c72c91db</EventRuleRef>
        <NotifierStart>true</NotifierStart>
        <NotifierEnd>true</NotifierEnd>
      </ObjectData>
    </Object>
    <Object>
      <TemplateGuid>bae7352b-1997-4f2e-afc1-6f48c72c91db</TemplateGuid>
      <TemplateVersion>12</TemplateVersion>
      <ObjectType>GpsGate.Online.Event.EventExpressionEvaluatorWriter</ObjectType>
      <ObjectData>
        <Name>No Entry Route Alarm</Name>
        <Description></Description>
        <EvaluationOperator>AND</EvaluationOperator>
        <EndEvaluationOperator>AND</EndEvaluationOperator>
        <SupportUI>false</SupportUI>
        <AutoClose>true</AutoClose>
        <Disabled>false</Disabled>
        <FinishOnPreCondition>true</FinishOnPreCondition>
        <UserMatchMethod>Tags</UserMatchMethod>
        <Expressions>
          <ExpressionRef>9b458a73-ec68-45ab-8c4c-06dc9d5302e8</ExpressionRef>
        </Expressions>
        <Notifiers>
          <NotifierRef>d0891fff-2aa3-425e-bdd9-2010c135c8ee</NotifierRef>
          <NotifierRef>e9c002c2-da1c-4405-a255-7a27e5430291</NotifierRef>
        </Notifiers>
        <PostConditions>
          <PostConditionRef>51f86a4a-9cdb-4b8f-b58b-edb77826f5b3</PostConditionRef>
        </PostConditions>
        <PreConditions>
          <PreConditionRef>014dd187-341c-44d8-ae31-44c5d57e3b31</PreConditionRef>
        </PreConditions>
        <TagIDs />
      </ObjectData>
    </Object>
    <Object>
      <TemplateGuid>9b458a73-ec68-45ab-8c4c-06dc9d5302e8</TemplateGuid>
      <TemplateVersion>12</TemplateVersion>
      <ObjectType>GpsGate.Online.Event.ScriptExpression</ObjectType>
      <ObjectData>
        <IsEndExpression>false</IsEndExpression>
        <IsOneShot>false</IsOneShot>
        <Script>var geofence_group = 'No Entry Route';

var st = context.state || {
  geofenceId: 0
};

var gfs = geofence.find(trackPoint.position.longitude, trackPoint.position.latitude, geofence_group);


var current = {
  geofenceId: gfs.length &gt; 0 ? gfs[0].id : 0
};

var result = st.geofenceId != current.geofenceId;

context.setState(current);

if (result) { 
  context.setVariable('NEW_GEOFENCE_ID', current.geofenceId);  
  if (st.geofenceId != current.geofenceId) {
	context.setVariable('OLD_GEOFENCE_ID', st.geofenceId);
  }  
}

return result;</Script>
      </ObjectData>
    </Object>
    <Object>
      <TemplateGuid>d0891fff-2aa3-425e-bdd9-2010c135c8ee</TemplateGuid>
      <TemplateVersion>12</TemplateVersion>
      <ObjectType>GpsGate.Online.Notification.SignalStartNotifier</ObjectType>
      <ObjectData>
        <Name>Signal Start Notifier</Name>
        <NotifierGroup>default</NotifierGroup>
        <Mode>Start</Mode>
      </ObjectData>
    </Object>
    <Object>
      <TemplateGuid>e9c002c2-da1c-4405-a255-7a27e5430291</TemplateGuid>
      <TemplateVersion>12</TemplateVersion>
      <ObjectType>GpsGate.Online.Notification.SignalEndNotifier</ObjectType>
      <ObjectData>
        <Name>Signal End Notifier</Name>
        <NotifierGroup>default</NotifierGroup>
        <Mode>Start</Mode>
      </ObjectData>
    </Object>
    <Object>
      <TemplateGuid>51f86a4a-9cdb-4b8f-b58b-edb77826f5b3</TemplateGuid>
      <TemplateVersion>12</TemplateVersion>
      <ObjectType>GpsGate.Online.Event.EventDurationEvaluatorPostCondition</ObjectType>
      <ObjectData>
        <Name>Event duration evaluator post condition</Name>
        <RelationalOperator>GREATER_OR_EQUAL</RelationalOperator>
        <EventDuration>0</EventDuration>
        <AutoTrigger>false</AutoTrigger>
      </ObjectData>
    </Object>
    <Object>
      <TemplateGuid>014dd187-341c-44d8-ae31-44c5d57e3b31</TemplateGuid>
      <TemplateVersion>12</TemplateVersion>
      <ObjectType>GpsGate.Online.Event.DayOfWeekPeriodEvaluatorPreCondition</ObjectType>
      <ObjectData>
        <Name>Day of week evaluator pre condition</Name>
        <Periods>
          <Period>
            <StartTimeOfDay>0</StartTimeOfDay>
            <StopTimeOfDay>863999990000</StopTimeOfDay>
            <DayOfWeek>All</DayOfWeek>
            <EvaluationMethod>Inside</EvaluationMethod>
          </Period>
        </Periods>
      </ObjectData>
    </Object>
  </Template>
</Templates>