Project

General

Profile

Bug #44 » chirp_memory.xsd

Updated schema - Mark Whitis, 01/07/2012 09:45 PM

 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:complexType name="memoryType">
<xsd:sequence>
<xsd:element name="shortName" type="shortNameType"/>
<xsd:element name="longName" type="longNameType" minOccurs="0"/>
<xsd:element name="frequency" type="frequencyType"/>
<xsd:element name="squelch" type="squelchType"
minOccurs="0" maxOccurs="3"/>
<xsd:element name="squelchSetting" type="xsd:string" minOccurs="0"/>
<xsd:element name="duplex" type="duplexType"/>
<xsd:element name="offset" type="frequencyType"/>
<xsd:element name="mode" type="modeType"/>
<xsd:element name="tuningStep" type="frequencyType"/>
<xsd:element name="skip" type="skipType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="bank" type="bankInfoType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="dv" type="dvType" minOccurs="0"/>
<xsd:element name="stationInfo" type="stationInfoType" minOccurs="0" maxOccurs="1"/>

</xsd:sequence>
<xsd:attribute name="location" type="xsd:nonNegativeInteger"/>
</xsd:complexType>

<xsd:simpleType name="shortNameType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[A-Z0-9/ >-]{0,6}"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="frequencyType">
<xsd:simpleContent>
<xsd:extension base="xsd:decimal">
<xsd:attribute name="units" type="freqUnitsType" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="freqUnitsType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Hz"/>
<xsd:enumeration value="kHz"/>
<xsd:enumeration value="MHz"/>
<xsd:enumeration value="GHz"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="longNameType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[.A-Za-z0-9/ >-]{0,16}"/>
</xsd:restriction>
</xsd:simpleType>


<xsd:complexType name="squelchType">
<xsd:sequence>
<xsd:element name="tone" type="xsd:decimal" minOccurs="0"/>
<xsd:element name="code" type="xsd:positiveInteger" minOccurs="0"/>
<xsd:element name="polarity" type="dtcsPolarityType" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="id"/>
<xsd:attribute name="type"/>
</xsd:complexType>

<xsd:simpleType name="dtcsPolarityType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[RN]{2}"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="duplexType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="positive"/>
<xsd:enumeration value="negative"/>
<xsd:enumeration value="none"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="modeType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="FM"/>
<xsd:enumeration value="NFM"/>
<xsd:enumeration value="WFM"/>
<xsd:enumeration value="AM"/>
<xsd:enumeration value="NAM"/>
<xsd:enumeration value="DV"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="dvType">
<xsd:sequence>
<xsd:element name="urcall" type="callsignType"/>
<xsd:element name="rpt1call" type="callsignType"/>
<xsd:element name="rpt2call" type="callsignType"/>
<xsd:element name="digitalCode" type="digitalCodeType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>

<!-- Info on repeater, digipeater, satellite, beacon, broadcast, or other station used on this channel -->
<!-- These fields allow repeater directories to be published in a format which can be readily imported into chirp for programming radios, or converted to GPX, KML, google earth, google maps, gpsbabel, HTML, etc. Or to use next generation radios which can automatically select repeaters based on your location or display maps of repeaters -->

<xsd:complexType name="stationInfoType">
<xsd:sequence>
<xsd:element name="coordinates" type="coordinatesType" minOccurs="0" maxOccurs="1"/>

<xsd:element name="callsign" type="callsignType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="Website" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<!-- could be xsd:anyURI but handlers for this may not exist elsewhere in program -->
<xsd:element name="antennaLocation" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<!-- example "Afton Mountain" -->
<xsd:element name="city" type="xsd:string" minOccurs="0" maxOccurs="1"/> <!-- nearest city, example "Afton" or "Charlottesville" -->
<xsd:element name="state" type="xsd:string" minOccurs="0" maxOccurs="1"/> <!-- example "VA" -->
<csd:element name="postalCode" type "xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="country" type="xsd:string" minOccurs="0" maxOccurs="1"/> <!-- example "US", ISO 2-letter code -->
<xsd:element name="Sponsor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<!-- Organization or person responsible for maintaining this station/owner. Example AARC, AMSAT, etc. -->
<xsd:element name="Comment" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="StationWatts" type="xsd:decimal" minOccurs="0" maxOccurs="1"/>
<xsd:element name="access" type="xsd:string" minOccurs="0" maxOccurs="1"/> <!-- "open"/"closed" -->
<xsd:element name="modulation" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<!-- FM, NarrowFM, AM, SSB, packet, CW, PSK31, APRS, D-Star, Pactor, etc. -->
<xsd:element name="antenna" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="irlpNode" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="echoNode" type="xsd:string" minOccurs="0" maxOccurs="1"/> <!-- echolink node -->
<xsd:element name="echoLinkNode" type="xsd:string" minOccurs="0" maxOccurs="1"/> <!-- echolink node -->
<xsd:element name="eQSONode" type="xsd:string" minOccurs="0" maxOccurs="1"/> <!-- echolink node -->

<xsd:element name="Autopatch" type "xsd:string" minOccurs="0" maxOccurs="1"/>


<xsd:sequence>
</xsd:complexType>

<xsd:complexType name="coordinatesType">
<xsd:sequence>
<xsd:element name="latitude" type="xsd:decimal" minOccurs="0" maxOccurs="1"/>
<xsd:element name="longitude" type="xsd:decimal" minOccurs="0" maxOccurs="1"/>
<xsd:element name="altitude" type="xsd:decimal" minOccurs="0" maxOccurs="1"/> <!-- antenna height -->
<xsd:element name="altitudeMode" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<!-- "relativeToGround" or "absolute" http://code.google.com/apis/kml/documentation/kmlreference.html#point -->
<xsd:element name="uncertainty" type="xsd:string" minOccurs="0" maxOccurs="1"/> <!-- uncertainty in lat/long/altitude. Example: "10meters" or "unknown". Did you measure it with an accurate GPS or did you estimate based on the generic location of Afton Mountain on a map or a city center? -->
<xsd:element name="datum" type="xsd:string" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>


<xsd:simpleType name="callsignType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[A-Z0-9/ ]*"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="digitalCodeType">
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="skipType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="S"/>
<xsd:enumeration value="P"/>
<xsd:enumeration value=""/>
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="bankInfoType">
<xsd:attribute name="bankId" type="xsd:nonNegativeInteger" use="required"/>
<xsd:attribute name="bankIndex" type="xsd:nonNegativeInteger"/>
</xsd:complexType>
</xsd:schema>

<!-- Comments by AK4OL:
In order to minimize exciting bugs in existing software, simple, already used, types such as xsd:decimal and xsd:string were used for most of the added fields. Existing code may not know how to handle xsd:all, xsd:anyURI, xsd:annotation/xsd:documentation etc.)

All occurances of xsd:sequence in this file should really be xsd:all. The program has no business enforcing a specific order. Interoperability dictates that you generate fields in the order listed but take them in any order; i.e. demand more of yourself than you demand of others. Strictly validate your output, not your input. Fools often get this backwards and destroy one of the primary advantages of XML). Interoperability also dictates that you do not choke on unrecognized fields as the program currently does; this means, for example, that version 1.0 will choke on version 2.0 files or files generated by other programs which use the same format but add extensions. This makes chirp files almost useless for information interchange between users or even between different machines used by the same user which may have different versions. Warn that there is unrecognized data but parse all the data you can. validate_doc() must be disabled or modified to produce warnings only. It is ok to require the file to be well formed xml but it is not ok to fail if their are unrecognized fields or the field order is different.

Chirp currently generates attrociously formatted XML - all on one line. Chirp can read properly formatted xml.
sudo apt-get install libxml-tidy-perl
xmltidy somefile.chirp # warning: modifies in place

Chirp already has the ability to hide fields which are not of interest. In addition, these additional fields will not be displayed if you are editing a radio file, just a chirp file.

location attribute on memoryType should be optional. If data has been imported, it may be meaningless or absent.

In xml.py
rf.memory_bounds = (0, 1000)
is probably a bug. Some radios have more than 1000 memories.

<memory location="17">
<shortName>WA4TFZ</shortName>
<longName>WA4TFZ</longName>
<frequency units="MHz">146.895000</frequency>
<squelch id="rtone" type="repeater">
<tone>151.4</tone>
</squelch>
<squelch id="ctone" type="ctcss">
<tone>88.5</tone>
</squelch>
<squelch id="dtcs" type="dtcs">
<code>023</code>
<polarity>NN</polarity>
</squelch>
<squelchSetting>rtone</squelchSetting>
<duplex>negative</duplex>
<offset units="MHz">0.600000</offset>
<mode>FM</mode>
<tuningStep units="kHz">5.00000</tuningStep>

<stationInfo>
<coordinates>
<latitude>38.105092</latitude>
<longitude>-78.744168</longitude>
<altitude>964m</altitude>
<uncertainty>1km</uncertainty>
</coordinates>
<callsign>WA4TFZ</callsign>
<website>http://www.albemarleradio.org/node/10</website>
<antennaLocation>Bucks Elbow Mtn</antennaLocation>
<city>Charlottesville</city>
<state>VA</state>
<postalCode>22932</postalCode>
<country>US</country>
<Sponsor>Albemarle Amateur Radio Club</Sponsor>
<Comment>coordinates approximated from google earth between visable antennas on summit; however, newsletter suggests that repeater was moved down from the summit, probably due to national radio quiet zone restrictions. Vertex repeater hardware</Comment>
<StationWatts></StationWatts>
<modulation>FM</modulation>
<antenna>2m/440 dual band</antenna>
<irlpNode></irlpNode>
<echoLinkNode></echoLinkNode>
<eQSONode></eQSONode>
<autopatch></autopatch>
</stationInfo>

</memory>

-->
(2-2/3)