<?xml version="1.0" encoding="utf-8"?>
<!-- $Id:  $ -->
<!-- Since: 2007-Oct-17 -->
<!-- AUTHOR: Kurt Schwehr -->
<!-- IMO 236 FAIRWAY CLOSED - Application 3 - 001-13  -->

<ais-binary-message version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">

  <!-- Stand alone version of a message 8 - includes header  -->

  <message name="imo_fairway_closed" aismsgnum="8" dac="001" fid="13" titlefield="UserID">
    <description>IMO fairway closed.  Specified
      in SN/Circ.236 Annex 2, page 4, Application 3.  Also defined in IALA Guidelines on AIS,
      Vol 1, Part 1, Ed. 1.3. Guildeline No 1028.

      This message should be used to inform ships, in particular to give
      guidance to large vessels about temporary closed fairways or sections
      in ports. Attributes: broadcast, shore station transmitting, no
      acknowledgement.
    </description>

    <messagesize>472</messagesize>

    <field name="MessageID" numberofbits="6" type="uint">
      <description>AIS message number.  Must be 8</description>
      <required>8</required>
    </field>

    <field name="RepeatIndicator" numberofbits="2" type="uint">
      <description>Indicated how many times a message has been repeated</description>
      <unavailable>0</unavailable>
      <lookuptable>
	<entry key="0">default</entry>
	<entry key="3">do not repeat any more</entry>
      </lookuptable>
      <testvalue>1</testvalue>
    </field>

    <!-- switch from SourceID to match ITU spec -->
    <field name="UserID" numberofbits="30" type="uint">
      <description>MMSI number of transmitter broadcasting the message</description>
      <note> Not sure if this matches what IMO stated.</note>
      <testvalue>1193046</testvalue> <!-- Default value for all NAUTICAST devices -->
    </field>

    <field name="Spare" numberofbits="2" type="uint">
      <description>Reserved for definition by a regional authority.</description>
      <required>0</required>
    </field>

    <!-- Called IAI in the IMO 236 doc -->
    <field name="dac" numberofbits="10" type="uint">
      <description>Designated Area Code - part 1 of the IAI</description>
      <required>1</required>
    </field>

    <field name="fid" numberofbits="6" type="uint">
      <description>Functional Identifier - part 2 of the IAI</description>
      <required>11</required>
    </field>

    <field name="reason" numberofbits="6" arraylength="20" type="aisstr6">
      <description>Reason for closing</description>
      <note>What are the range of reasons?  Are they predefined or free form?</note>
      <unavailable>@@@@@@@@@@@@@@@@@@@@</unavailable>
      <testvalue>FIX GIVE SAMPLE     </testvalue> <!-- must be uppercase -->
    </field>

    <field name="from" numberofbits="6" arraylength="20" type="aisstr6">
      <description>Location of closing from</description>
      <note>Need an explanation of this</note>
      <unavailable>@@@@@@@@@@@@@@@@@@@@</unavailable>
      <testvalue>FIX GIVE SAMPLE     </testvalue> <!-- must be uppercase -->
    </field>

    <field name="to" numberofbits="6" arraylength="20" type="aisstr6">
      <description>Location of closing To</description>
      <note></note>
      <unavailable>@@@@@@@@@@@@@@@@@@@@</unavailable>
      <testvalue>FIX GIVE SAMPLE     </testvalue> <!-- must be uppercase -->
    </field>


    <field name="radius" numberofbits="10" type="uint">
      <description>Extention of closed area</description>
      <note>WARNING: the units of this value are determined by the unit field</note>
      <units>See unit field</units>
      <range min="0" max="1000"/>
      <unavailable>1001</unavailable>
      <testvalue>321</testvalue>
    </field>

    <!-- comment by Kurt... mixing representation into the units is not a good idea -->
    <field name="unit" numberofbits="2" type="uint">
      <description>Unit of extension value for range field</description>
      <lookuptable>
	<entry key="0">m</entry>
	<entry key="1">km</entry>
	<entry key="2">nm</entry>
	<entry key="3">cbl</entry> <!-- FIX: what kind of unit is this?!?! -->
      </lookuptable>
      <testvalue>0</testvalue>
    </field>

    <field name="closingday" numberofbits="5" type="uint">
      <description>Closing from day</description>
      <testvalue>31</testvalue>
    </field>

    <field name="closingmonth" numberofbits="4" type="uint">
      <description>Closing from month</description>
      <testvalue>12</testvalue>
    </field>

    <field name="fromhour" numberofbits="5" type="uint">
      <description>From LT hour (appr)</description>
      <note>FIX: what is LT?</note>
      <testvalue>20</testvalue>
    </field>

    <field name="frommin" numberofbits="6" type="uint">
      <description>From LT minute (appr)</description>
      <testvalue>23</testvalue>
    </field>

    <field name="today" numberofbits="5" type="uint">
      <description>To day</description> 
      <testvalue>27</testvalue>
    </field>

    <field name="tomonth" numberofbits="4" type="uint">
      <description>To month</description> 
      <testvalue>2</testvalue>
    </field>

    <field name="tohour" numberofbits="5" type="uint">
      <description>To LT hour (appr)</description> 
      <testvalue>22</testvalue>
    </field>

    <field name="tomin" numberofbits="6" type="uint">
      <description>To LT minute (appr)</description>
      <testvalue>35</testvalue>
    </field>

    <field name="spare2" numberofbits="4" type="uint">
      <description>Padding out the slot</description>
      <required>0</required>
    </field>
  </message>
  
</ais-binary-message>

