-
Notifications
You must be signed in to change notification settings - Fork 4
NFC
Jeff Olajos edited this page Oct 1, 2024
·
53 revisions
<NFC/> : DataSource
The NFC Datasource is a custom Data Widget that returns nfc data from the device hardware that can be read or written to. Data read by the NFC widget can be bound to, including serialized url attributes.
- NFC can only be enabled on devices with an NFC reader.
| Name | Type | Default | Description | Req |
|---|---|---|---|---|
| id | string | null | The id of the widget used for databinding. | |
| method | string | read |
read or write
|
|
| enabled | bool | true | If the datasource is enabled. | |
| onsuccess | string/Event | null | events the broker will execute upon a successful read or write | |
| onfail | string/Event | null | events the broker will execute if the read or write operation fails | |
| autoexecute | bool | true | if the NFC read/write operation will happen automatically at startup | |
| received | int | The number of NFC tags read. | ||
| serial | string | The last NFC tag serial# | ||
| payload | string | The last NFC tag text |
| Name | Type | Description |
|---|---|---|
| id | The NFC tag serial# | |
| serial | The NFC tag serial# | |
| payload | The NFC tag text |
| Name | Type | Default | Description | Req |
|---|---|---|---|---|
| data | List[?] | If the NFC tag text is encoded as a JSON, XML or URL string, it is deserialized, otherwise it is deserialized as a Data Point. Note: URL's do not neeed to be encoded with their fully qualified domain name. To save space, this can be just a query string (with or without the ?). Only the URL's query parameters are deserialized. The resulting item is addressable using standard DOTNOTATION, |
||
| queuetype | string | replace |
replace, lifo, fifo, append, prepend. Defines the data aggregation strategy for data returned from initial and subsequent calls. replace (default) replaces all data after each subsequent call. lifo (last in first out), fifo (first in first out), append and prepend are all used in conjunction with the maxrecords attribute |
|
| maxrecords | int | 10000 | The maximum size data can grow to. This works in concert with type
|
|
| root | string | The root tag that defines the repeatable items in data. This can be a nested field. If not specified, the list is segmented by the first repeatable element found in the data set |
||
| ttl | int(s,m,h) | 0s |
Time to Live caches data in the local persistent HIVE database for the period specified. This saves requerying data that changes infrequently |
|
| rowcount | int | 0 | The number of records in data
|
| Name | Type | Description |
|---|---|---|
| clear() | Clears data. Invoked in any EVENT string using <id>.clear() |
|
| add(jsonOrXml, index) | string, int | Deserializes the jsonOrXml string and adds it to the end of data or at position index if specified. Invoked in any EVENT string using <id>.add(jsonOrXml, index) |
| remove(index) | int | Removes the last item from data or from position index if specified. Invoked in any EVENT string using <id>.remove(index) |
| reverse() | Reverses data. Invoked in any EVENT string using <id>.reverse() |
| Name | Type | Description |
|---|---|---|
| start() | If method = "read" (default), the NCF starts listening for NCF taps. If method = "write", the NCF starts the write operation using the NCF body. Invoked in any EVENT string using <id>.start() |
|
| read() | If method = "read" (default), the NCF starts listening for NCF taps. If method = "write", this operation is ignored. Invoked in any EVENT string using <id>.read() |
|
| write(message) | string | If method = "write", the message passed is written to the tag. If the message is null, the NFC body is used. If method = "read", this operation is ignored. Invoked in any EVENT string using <id>.write('some text to write') |
| stop() | If method = "read" (default), the NCF stops listening for NCF taps. If method = "write", the NCF cancels the write operation. Invoked in any EVENT string using <id>.stop() |
|
| clear() | Clears the data bindable. Invoked in any EVENT string using <id>.clear() |
<NFC id="DB1"/>
<BOX height="80" />
<TEXT label="Reads: {DB1.received}" color="black" size="11"/>
<TEXT label="Last Tag#: {DB1.serial}" color="black" size="11"/>
<TEXT label="Last Tag: {DB1.payload}" color="black" size="11"/>
<!-- NCF tag body is encoded as a valid json string -->
<!-- { "book" : { "sku" : "1222345-1", "name" : "Tesla, SpaceX, and the Quest for a Fantastic Future", "author" : "Elon Musk" } } -->
<TEXT label="Read Result: {DB1.data.book.sku}" color="black" size="11"/>
<TEXT label="Read Result: {DB1.data.book.name}" color="black" size="11"/>
<TEXT label="Read Result: {DB1.data.book.author}" color="black" size="11"/>
</BOX><NFC id="DB1"/>
<BOX height="80" />
<TEXT label="Reads: {DB1.received}" color="black" size="11"/>
<TEXT label="Last Tag#: {DB1.serial}" color="black" size="11"/>
<TEXT label="Last Tag: {DB1.payload}" color="black" size="11"/>
<!-- NCF tag body is encoded as a url query string -->
<!-- sku=1222345-1&name=Tesla, SpaceX, and the Quest for a Fantastic Future&author=Elon Musk -->
<TEXT label="Read Result: {DB1.data.sku}" color="black" size="11"/>
<TEXT label="Read Result: {DB1.data.name}" color="black" size="11"/>
<TEXT label="Read Result: {DB1.data.author}" color="black" size="11"/>
</BOX><NFC id="DB1"/>
<BOX height="80" />
<TEXT label="Reads: {DB1.received}" color="black" size="11"/>
<TEXT label="Last Tag#: {DB1.serial}" color="black" size="11"/>
<TEXT label="Last Tag: {DB1.payload}" color="black" size="11"/>
<!-- NCF tag body is encoded as a simple string -->
<!-- 1222345-1 Tesla, SpaceX, and the Quest for a Fantastic Future Elon Musk -->
<TEXT label="Read Result: {DB1.data.serial}" color="black" size="11"/>
<TEXT label="Read Result: {DB1.data.payload}" color="black" size="11"/>
</BOX>Framework Markup Language is an open source programming language created by AppDaddy Software Solutions Inc. FML and is licensed under a fair source license agreement and is maintained by a community of developers.
- Quick Start
- Widget Structure
- Layout Basics
- Config
- Navigation
- Authentication
- Server Configuration
- Offline Use
- Resource Guides
-
<FML/>
- <BOX/>
- <CHART/>
- <COLUMN/>
- <DRAWER/>
- <FOOTER/>
- <FORM/>
- <GRID/>
- <HEADER/>
- <LIST/>
- <MAP/>
- <WINDOW/>
- <PAGER/>
- <ROW/>
- <SCROLLER/>
- <SPLITVIEW/>
- <STACK/>
- <TABLE/>
- <TABVIEW/>
- <TREEVIEW/>
- <WEBVIEW/>
Important Concepts