1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2018 The Android Open Source Project
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8          http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15-->
16<!-- This xml is the command's structure about supplementary service by ussd command.
17     It defines the feature (e.g. call forwarding , caller id), command, parameter, result,
18     response ,and response's value definition.
19     Developer can use the CarrierXmlParser.java to load this xml structure and use function to
20     make ussd command by structure and analyze the ussd response.
21
22     If developer need to define ussd command by specific carrier, developer can add new xml and
23     xml is named carrier_ss_string_carrierId.xml. The carrierId is a number and is defined in
24     <a href="https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/master/assets/latest_carrier_id/carrier_list.textpb">here</a>
25     For example: carrier_ss_string_850.xml
26
27     The tags define as below:
28     <regular_parser> : It is a regular expression for response massage.
29     <feature name="callforwarding"> : It defines feature about call forwarding.
30     <command name="query"> : The command which is named "query" in feature.
31     <service_code> : The command's service code. The value defines by carrier.
32     <action_code> : From TS 22.030 6.5.2, the procedure always starts with *, #, **, ## or *#.
33     <parameter number="1"> : The parameter is supplementary Information. The number defines the
34                              number of entries.
35     <entry position="1">1</entry> :
36        This defines the entry and entry's position and entry's text.
37        The 'position' is the parameter's position.
38        For example: #120*parameter1*parameter2*parameter3*parameter4#
39            parameter1 position=1
40            parameter2 position=2
41            parameter3 position=3
42            parameter4 position=4
43        The entry's text is define the parameter's value. If developer want to dynamic input,
44        text can use string witch start with "tag_" and define in CarrierXmlParser.java.
45        e.g. "tag_number","tag_time"
46     <response_format number ="3"> : This defines the response message format. The number means
47     the number of parameters.
48     <entry position="6" key="status_code"/> :
49         It defines response message's parameter.
50         The 'position' is the index of parser result which is by <regular_parser>.
51         The 'key' is the variable's name which is defined in CarrierXmlParser.java. Developer can
52         get response value by key's name.
53         For example:
54             120*1*7*number*time*1*0*0# parse by <regular_parser>
55             120    position= 2
56             1      position= 4
57             7      position= 6
58             number position= 8
59             time   position= 10
60     <command_result number="3"> :
61         It defines the meaning for 'key' of 'response_format'.
62         The 'number' means the number of entries.
63     <entry key="status_code" definition="activate">7</entry> :
64         The 'key' is the same as 'key' of <response_format>.
65         The 'definition' is meaning for 'key' when response value is the same as text.
66         For example:
67         If response command is 120*1*7*1# and entry is
68         <entry key="status_code" definition="activate">7</entry>
69         After message parse, the result is that key="status_code" and value is 7.
70         After mapping <command_result>, this means that status_code is activate, when key's value
71         is 7 from response message.
72-->
73
74<resources>
75    <!-- This is a parser format by Regular Expression.
76         "response_format"'s position follow below index.
77         ((\d{2,3})(\*([^*#]*)(\*([^*#]*)(\*([^*#]*)(\*([^*#]*)(\*([^*#]*)(\*([^*#]*)(\*([^*#]*))?)?)?)?)?)?)?#)
78         1 2       3  4       5  6       7  8       9  10      11 12     13  14      15 16
79    -->
80    <regular_parser>((\d{2,3})(\*([^*#]*)(\*([^*#]*)(\*([^*#]*)(\*([^*#]*)(\*([^*#]*)(\*([^*#]*)(\*([^*#]*))?)?)?)?)?)?)?#)</regular_parser>
81    <feature name="callforwarding">
82        <command name="query"><!--For example: *#120*1#-->
83            <service_code>120</service_code>
84            <action_code>*#</action_code>
85            <parameter number="1">
86                <entry position="1">1</entry>
87            </parameter>
88            <response_format number ="3"><!--For example: 120*1*7*number*time*1*0*0#-->
89                <entry position="6" key="status_code"/>
90                <entry position="8" key="number"/>
91                <entry position="10" key="time" />
92            </response_format>
93        </command>
94        <command name="activate"><!--For example: *120*1*number*time#-->
95            <service_code>120</service_code>
96            <action_code>*</action_code>
97            <parameter number="3">
98                <entry position="1">1</entry>
99                <entry position="2">tag_number</entry>
100                <entry position="3">tag_time</entry>
101            </parameter>
102            <response_format number="1"><!--For example: 120*1*7*1#-->
103                <entry position="6" key="status_code"/>
104            </response_format>
105        </command>
106        <command name="deactivate"><!--For example: #120*1#-->
107            <service_code>120</service_code>
108            <action_code>#</action_code>
109            <parameter number="1">
110                <entry position="1">1</entry>
111            </parameter>
112            <response_format number="1"><!--For example: 120*1*6*2#-->
113                <entry position="6" key="status_code"/>
114            </response_format>
115        </command>
116        <command_result number="3">
117            <entry key="status_code" definition="activate">7</entry>
118            <entry key="status_code" definition="deactivate">6</entry>
119            <entry key="status_code" definition="unregister">4</entry>
120        </command_result>
121    </feature>
122    <feature name="callerid">
123        <command name="activate"><!--For example: *148*2*password#-->
124            <service_code>148</service_code>
125            <action_code>*</action_code>
126            <parameter number="2">
127                <entry position="1">2</entry>
128                <entry position="2">tag_password</entry>
129            </parameter>
130            <response_format number="1"><!--For example: 148*7#-->
131                <entry position="4" key="status_code"/>
132            </response_format>
133        </command>
134        <command name="deactivate"><!--For example: *148*1*password#-->
135            <service_code>148</service_code>
136            <action_code>*</action_code>
137            <parameter number="2">
138                <entry position="1">1</entry>
139                <entry position="2">tag_password</entry>
140            </parameter>
141            <response_format number="1"><!--For example: 148*7#-->
142                <entry position="4" key="status_code"/>
143            </response_format>
144        </command>
145        <command_result number="1">
146            <entry key="status_code" definition="ok">7</entry>
147        </command_result>
148    </feature>
149</resources>
150