PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Motorola FX7400 RFID reading
Motorola FX7400 RFID reading
Iniciado por guest, 20,abr. 2015 12:31 - 3 respuestas
Publicado el 20,abril 2015 - 12:31
Dear Windev Coders,
I am struggling to convert the below C# code into Windev code, using Windev 18.
I am seeking for support..
=============================================


Main reader object = RFIDReader
// --Reader declarations -----
RFIDReader reader;
// ---------------------------------
Initialize and Connect to RFID reader
// --Reader initializations -----
reader = new RFIDReader(“157.235.88.253", 0, 0);
reader.Connect();
// ---------------------------------
Disable ‘AttachTagDataWithReadEvent’

// ---------------------------------
reader.Events.AttachTagDataWithReadEvent = false;
// ---------------------------------
Register for read notifications
// ---------------------------------
reader.Events.ReadNotify +=
new Events.ReadNotifyHandler(Events_ReadNotify);
// ---------------------------------
Start polling
// ---------------------------------
reader.Actions.Inventory.Perform();
// ---------------------------------



Callback function
// ---------------------------------
void Events_ReadNotify(object sender,
Events.ReadEventArgs e)
{
TagData[ ] tagData = reader.Actions.GetReadTags(1000);
if ((tagData != null) && (tagData.Length > 0))
{
foreach(TagData t in tagData)
{
UpdateListBox(t.TagID+" : "+t.AntennaID.ToString());
}
}
}

// ---------------------------------
Stop polling
// ---------------------------------
reader.Actions.Inventory.Stop();
// ---------------------------------
Disconnect from RFID reader
// --Reader initializations -----
reader.Disconnect();
// ---------------------------------

=============================================
Publicado el 21,abril 2015 - 14:42
Hi Mitchell,

Do you get somewhere?

Many information are missing in the code snippet. What is actually the RFIDReader class? Is it a .Net class? Is it a standard TCP/IP socket? Is it from a DLL or Activex?

The RFIDReader class is the key to the answer of your question. Depending of what the object is and how it can be created in WinDev, it will dictate the proper "translation" into WLanguage.

Best regards,
Alexandre Leclerc
Publicado el 23,abril 2015 - 06:13
thanks alex,
RFIDReader class is a .net class which I imported into Windev, still in trouble here...
Publicado el 23,abril 2015 - 14:36
Hi Mitchell,

My own .Net experience is not very large (in fact, it is minimalist). In WinDev you simply add the .Net package to your project. Then its parts will be available. In your .Net packages folder in the project explorer you should be able to see your RFIDReader class somewhere.

Then you should be able to declare the object very simply like a normal variable.

Reader is a RFIDReader(“157.235.88.253", 0, 0)
Reader.Connect()

// For this one, maybe it works like that directly, maybe you must use an object, I do not know:

Reader.Events.AttachTagDataWithReadEvent = False

// To add the read notify, you will have to look at what the function is waiting for and give it. Probably there is a kind of "Add" function that has been added, just check the project explorer, etc.

// Events_ReadNotify is your Windev function that receive the events (your callback)
pclReadNotify is a Events.ReadNotifyHandler dynamic
pclReadNotify = DotNetDelegate(Events_ReadNotify,"Events.ReadNotifyHandler")

// Assuming a kind of "add" function added (should be):
Reader.Events.add_ReadNotify(pclReadNotify)

// Pooling (I think it should work straight away):
Reader.Actions.Inventory.Perform()

// Callback:
PROCEDURE Events_ReadNotify(sender, e)
// You will have to guess the type from the .Net folder in project explorer, ... then you can use sender.xyz, etc. and e.xyz, etc.


// Stop pooling:
Reader.Actions.Inventory.Stop()
Reader.Disconnect()


As I said, my experience is very low, but hopefully these few lines will help you find your way. Also, you might be interested at looking the different .Net examples available in WinDev to help you understand how WinDev works with .Net (this is usually what I do).

And maybe someone else with more knowledge can jump in to give you more precise or correct help.

Best regards,
Alexandre Leclerc