AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / Funciones NFC
  • Properties specific to nfcData variables
  • Reinitialization
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
The nfcData type is used to describe and handle the data of a variable of type nfcTag. You can define and change the characteristics of this data using different WLanguage properties.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Ejemplo
Android
// Write a url into an NFC tag
tag is nfcTag
url is nfcData
url.Type = nfcURI
url.Content = "www.pcsoft.com"
Add(tag, url)
NFCWriteTag(tag)
IF ErrorOccurred = True THEN
	Error("Unable to write NFC tag.", ErrorInfo())
END
Android
// Save an image in an NFC tag
tag is nfcTag
url is nfcData
url.Type = nfcMedia
url.Content = fLoadBuffer(CompleteDir(SysDirStorageCard()) + "imagepng")
url.MIMEType = "image/png"
Add(tag, url)
NFCWriteTag(tag)
IF ErrorOccurred = True THEN
	Error("Unable to write NFC tag.", ErrorInfo())
END
// Read the data of an NFC tag
tag is nfcTag
tag = NFCReadTag()
IF NOT ErrorOccurred = True THEN
	FOR EACH data OF tag.Data
		SWITCH data.Type
			CASE nfcText
				sLanguage is string = LanguageToName(data.Language)
				sText is string = data.Content
			CASE nfcURI
				IF StringStartsWith(data.Content, "http") THEN
					BrowserRunApp(data.Content)
				END
			CASE nfcMedia
				IF data.MIMEType ~= "image/png" THEN
					fSaveBuffer(CompleteDir(SysDirStorageCard()) +  ...
						"image.png", data.Content)
				END
		END
	END
END
Propiedades

Properties specific to nfcData variables

The following properties can be used to handle data of an NFC tag:
Property nameType usedEffect
ContentBinary/BufferData content. Its type depends on the value of the Type property.
If the Type property corresponds to:
  • the nfcText constant:
    • Android the Content property can be an Ansi or Unicode string.
    • iPhone/iPadIOS Widget the Content property is a Unicode string.
    Android When writing the NFC tag:
    • if the Content property is an ANSI string, the text will be encoded in UTF-8,
    • if the Content property is a Unicode string, the text will be encoded in UTF-16.
  • the nfcURI constant, the Content property corresponds to an Ansi string.
  • the nfcMedia constant, the Content property corresponds to a buffer.
    The interpretation of the buffer data depends of MIME type associated with the nfcData variable.
  • the constant nfcVide: A fatal error will be triggered if an attempt is made to modify the property Contenu.
  • the constant nfcInconnu: A fatal error will be triggered if an attempt is made to modify the property Contenu.
iPhone/iPadIOS Widget This property is read-only.
LanguageIntegerLanguage of the text stored in the Content property.
This property must be used only when the type of the nfcData variable is nfcText. A fatal error will occur if there is an attempt to read or modify the Language property of a variable of type nfcData or a different type.
By default, the Language property is initialized with the current language of the application.
To find out:
iPhone/iPadIOS Widget This property is read-only.
MIMETypeCharacter stringMIME type of the resource stored in the Content property.
The specified MIME type can correspond to:
  • a standard MIME type. More than 150 types are defined in the MIME communication standard (available on Internet). The most common values are:
    • "application/pdf": PDF file (*.pdf)
    • "text/html": HTML page (*.htm, *.html)
    • "text/plain": text file (*.txt)
    • "image/gif": GIF image (*.gif)
    • "image/jpeg": JPEG image (*.jpg, *.jpeg)
    • "video/mpeg": MPEG video (*.mpg, *.mpeg)
    • "application/msword": Word file.
    • "application/vnd.ms-excel": Excel file.
  • a custom type.
The MIMEType property must be used only when the nfcData variable is of type nfcMedia. A fatal error will occur if there is an attempt to read or modify the MIMEType property of a variable of type nfcData or a different type.
iPhone/iPadIOS Widget This property is read-only.
TypeInteger constantType of data, corresponding to one of the following constants:
  • nfcText Text data.
  • nfcURI URI (Uniform Resource Identifier) data type. Can correspond to:
    • the url of a Web page (http://www.windev.com),
    • an FTP address (ftp://ftp.windev.com/),
    • a phone number (tel:0123456789),
    • an email address (mailto:address@mail.com), etc.
      You have the ability to use ShellExecute with this URI (for example, to open the browser when the URI corresponds to the address of a Web site).
  • nfcMedia Media type data. Can correspond to any resource identified by a MIME type (image, video, document, etc.).
  • nfcVide Empty type. This type is used when creating a variable of type nfcData as long as no data type has been specified.
  • nfcUnknown Type unknown.
Important note Changing the type of a variable of type nfcData variable results in a reset of its contents. Therefore, don't forget to specify the type before the content.
iPhone/iPadIOS Widget This property is read-only.
Observaciones

Reinitialization

You can use VariableReset to reset the content of a variable of type nfcData.
Versión mínima requerida
  • Versión 18
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 28/03/2025

Señalar un error o enviar una sugerencia | Ayuda local