|
1 /* Copyright 2012 Mozilla Foundation and Mozilla contributors |
|
2 * |
|
3 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 * you may not use this file except in compliance with the License. |
|
5 * You may obtain a copy of the License at |
|
6 * |
|
7 * http://www.apache.org/licenses/LICENSE-2.0 |
|
8 * |
|
9 * Unless required by applicable law or agreed to in writing, software |
|
10 * distributed under the License is distributed on an "AS IS" BASIS, |
|
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 * See the License for the specific language governing permissions and |
|
13 * limitations under the License. |
|
14 */ |
|
15 |
|
16 /* Copyright © 2013, Deutsche Telekom, Inc. */ |
|
17 |
|
18 // Set to true to debug all NFC layers |
|
19 this.DEBUG_ALL = false; |
|
20 |
|
21 // Set individually to debug specific layers |
|
22 this.DEBUG_WORKER = false || DEBUG_ALL; |
|
23 this.DEBUG_CONTENT_HELPER = false || DEBUG_ALL; |
|
24 this.DEBUG_NFC = false || DEBUG_ALL; |
|
25 |
|
26 // Current version |
|
27 this.NFC_MAJOR_VERSION = 1; |
|
28 this.NFC_MINOR_VERSION = 7; |
|
29 |
|
30 this.NFC_REQUEST_CONFIG = 0; |
|
31 this.NFC_REQUEST_CONNECT = 1; |
|
32 this.NFC_REQUEST_CLOSE = 2; |
|
33 this.NFC_REQUEST_GET_DETAILS = 3; |
|
34 this.NFC_REQUEST_READ_NDEF = 4; |
|
35 this.NFC_REQUEST_WRITE_NDEF = 5; |
|
36 this.NFC_REQUEST_MAKE_NDEF_READ_ONLY = 6; |
|
37 |
|
38 this.NFC_RESPONSE_GENERAL = 1000; |
|
39 this.NFC_RESPONSE_CONFIG = 1001; |
|
40 this.NFC_RESPONSE_READ_NDEF_DETAILS = 1002; |
|
41 this.NFC_RESPONSE_READ_NDEF = 1003; |
|
42 |
|
43 this.NFC_NOTIFICATION_INITIALIZED = 2000; |
|
44 this.NFC_NOTIFICATION_TECH_DISCOVERED = 2001; |
|
45 this.NFC_NOTIFICATION_TECH_LOST = 2002; |
|
46 |
|
47 this.NFC_TECHS = { |
|
48 0:"NDEF", |
|
49 1:"NDEF_WRITEABLE", |
|
50 2:"NDEF_FORMATABLE", |
|
51 3:"P2P", |
|
52 4:"NFC_A", |
|
53 5:"NFC_B", |
|
54 6:"NFC_F", |
|
55 7:"NFC_V", |
|
56 8:"NFC_ISO_DEP" |
|
57 }; |
|
58 |
|
59 // TODO: Bug 933595. Fill-in all error codes for Gonk/nfcd protocol |
|
60 this.GECKO_NFC_ERROR_SUCCESS = 0; |
|
61 this.GECKO_NFC_ERROR_GENERIC_FAILURE = 1; |
|
62 |
|
63 // NFC powerlevels must match config PDUs. |
|
64 this.NFC_POWER_LEVEL_UNKNOWN = -1; |
|
65 this.NFC_POWER_LEVEL_DISABLED = 0; |
|
66 this.NFC_POWER_LEVEL_LOW = 1; |
|
67 this.NFC_POWER_LEVEL_ENABLED = 2; |
|
68 |
|
69 this.TOPIC_XPCOM_SHUTDOWN = "xpcom-shutdown"; |
|
70 |
|
71 this.NFC_PEER_EVENT_READY = 0x01; |
|
72 this.NFC_PEER_EVENT_LOST = 0x02; |
|
73 |
|
74 // Allow this file to be imported via Components.utils.import(). |
|
75 this.EXPORTED_SYMBOLS = Object.keys(this); |