Siemens RF182C Operating Instructions Manual page 92

Rfid systems
Table of Contents

Advertisement

Examples/applications
10.2 RF182C user application
// (ReceiveCallback is asynchronous)
lock (ReceiveBuffer)
{
for (XMLTag tag = FirstTag(); tag != null; tag = FirstTag())
{
}
}
}
// Looks for the first complete XML telegram in ReceiveBuffer.
private XMLTag FirstTag()
{
// Is there a reply, a notification or an alarm
int index1 = ReceiveBuffer.IndexOf("<reply>");
int index2 = ReceiveBuffer.IndexOf("<notification>");
int index3 = ReceiveBuffer.IndexOf("<alarm>");
if( index1==-1 && index2==-1 &&index3==-1) return null; //No XML tag found
if (index1 == -1) index1 = Int32.MaxValue;
if (index2 == -1) index2 = Int32.MaxValue;
if (index3 == -1) index3 = Int32.MaxValue;
//Assume that the first tag is an alarm
String endTag="</alarm>";
XMLTag tag = new XMLTag();
tag.type="alarm";
tag.startIndex = index3;
//See if this is true and change it if necessary
if (index1 < index2 && index1 < index3)
{
92
// Extract the parsed message and append it
String message = ReceiveBuffer.Substring(tag.startIndex, tag.length);
AppendInMessage(message);
// Remove parsed message from ReceiveBuffer
ReceiveBuffer = ReceiveBuffer.Substring(tag.startIndex + tag.length);
// See if we got information about detected tags
if (message.Contains("<tagCount>"))
{
if (message.Contains("<tagCount>0000</tagCount>"))
{
//There are no tags in the field
SetTagDetectionState(TagDetectionState.NO);
}
else
{
// There are tags in the field
SetTagDetectionState(TagDetectionState.YES);
}
}
RF182C communication module
Operating Instructions, 10/2010

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents