RFID Toys Homepage
Holy crap, check out the Dangerous Things store!
Forum Home Forum Home > Projects and such > Reader Projects
  New Posts New Posts RSS Feed - Logging Out
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Logging Out

 Post Reply Post Reply Page  <12
Author
Message
willsterstyle View Drop Down
Newbie
Newbie
Avatar

Joined: 04 February 2007
Location: Canada
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote willsterstyle Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2007 at 10:09am
I just found phidget21.h and phidget21.lib from some examples on the phidgets website,

I'm trying to compile it now but there seems to be some incompatibility in the code between the library versions?  I get 3 errors:

--------------------Configuration: PolLib - Win32 Release--------------------
Compiling...
PolLib.cpp

C:\Documents and Settings\William Tang\Desktop\RFID Files\pollginasrc\PollGina\rfidPolLib\PolLib.cpp(86) : error C2660: 'CPhidgetRFID_getOutputState' : function does not take 1 parameters

C:\Documents and Settings\William Tang\Desktop\RFID Files\pollginasrc\PollGina\rfidPolLib\PolLib.cpp(100) : error C2664: 'CPhidget_open' : cannot convert parameter 1 from 'struct _CPhidgetRFID *' to 'struct _CPhidget *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

C:\Documents and Settings\William Tang\Desktop\RFID Files\pollginasrc\PollGina\rfidPolLib\PolLib.cpp(166) : error C2664: 'CPhidget_close' : cannot convert parameter 1 from 'struct _CPhidgetRFID *' to 'struct _CPhidget *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

rfidPoll.dll - 3 error(s), 0 warning(s)

Back to Top
amal View Drop Down
Admin Group
Admin Group
Avatar

Joined: 22 November 2005
Location: United States
Status: Offline
Points: 2061
Post Options Post Options   Thanks (0) Thanks(0)   Quote amal Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2007 at 11:01am

Yes, there are code incompatibilities... this is part of the reason I really don't care for Phidgets devices and code. Not only do they arbitrarily change the library binary and code compatibility, they change the physical dimensions of their devices without warning. When I wrote the book, the RFID reader board had certain dimensions, which fit perfectly in project boxes. But, by the time the book was published they had changed the size of the board without any word of it to anyone. They also changed the way the hardware actually worked so you'd need the new library. So, basically because nothing was backward compatible, if you had a couple old readers and put your project into production, then bought a new reader, you had to totally recompile the entire project and update all your code... so annoying...

Ok, rant over... what you have to do is download the documentation for the 2.1 library and cross reference the properties and methods against the 2.0 library, updating the code where needed.

Amal ;)
www.amal.net
Back to Top
willsterstyle View Drop Down
Newbie
Newbie
Avatar

Joined: 04 February 2007
Location: Canada
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote willsterstyle Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2007 at 12:25pm
Hey Amal,

I finally have the log out stuff working except for one thing

I've been using the logging off code you provided via ExitWindows with user32 library.  However when I run it, I get:

Run-time error '453'

Can't find DLL entry point Exit Windows in user32

What's wrong?

Oh got it working :)  Had to use slightly different code than the one you gave me


Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long

Private Const EWX_LOGOFF = 0
Private Const EWX_FORCE = 4

ExitWindowsEx EWX_LOGOFFF + EWX_FORCE, 0


Edited by willsterstyle - 07 May 2007 at 8:09pm
Back to Top
willsterstyle View Drop Down
Newbie
Newbie
Avatar

Joined: 04 February 2007
Location: Canada
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote willsterstyle Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2007 at 10:14pm
log out program almost complete except for this one problem

Right now, a tag must be placed on the reader at all times..once its removed, it'll either lock out or log off.

The problem is that if no tag is placed on the reader to begin with, neither OnTag or OnTagLost are triggered so it just sort of sits there in the form.

I read the documentation and it said that OnTagLost is only triggered if a tag is first detected and then after 250ms, it'll trigger OnTagLost.  Is there any way around this? 

I've tried to think of ways to first trigger OnTag in the form (ie RF_OnTag "0b00") to try to fake it by giving it a TagNumber but that doesn't do anything as it just goes back to the form to "End Sub"

Any ideas?

Back to Top
amal View Drop Down
Admin Group
Admin Group
Avatar

Joined: 22 November 2005
Location: United States
Status: Offline
Points: 2061
Post Options Post Options   Thanks (0) Thanks(0)   Quote amal Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2007 at 10:13am

Hmm yeah, the library makes it's own rules for the ontaglost event. Basically, you'll have to create your own tag detection system. It should be very easy to do, and you could do it in a number of different ways.

One way you could do it would be to create a global variable to store the time and date of the last tag read. On every tag read event, set the global var to the current time and date. Then use a timer set to 1 second to check that global variable against the current time and date using datediff... if you haven't got a new tag read in 3 seconds, then run the log off / lock code.

Amal ;)
www.amal.net
Back to Top
willsterstyle View Drop Down
Newbie
Newbie
Avatar

Joined: 04 February 2007
Location: Canada
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote willsterstyle Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2007 at 5:29pm
is the ontaglost only available for the 2.1 library?
Back to Top
amal View Drop Down
Admin Group
Admin Group
Avatar

Joined: 22 November 2005
Location: United States
Status: Offline
Points: 2061
Post Options Post Options   Thanks (0) Thanks(0)   Quote amal Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2007 at 2:20pm

Originally posted by willsterstyle willsterstyle wrote:

is the ontaglost only available for the 2.1 library?

Yes I believe so. I've not used the 2.1 library myself.

Amal ;)
www.amal.net
Back to Top
willsterstyle View Drop Down
Newbie
Newbie
Avatar

Joined: 04 February 2007
Location: Canada
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote willsterstyle Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2007 at 7:19pm
another quick one

would it be possible to install two libraries and have two separate programs use one of the two?
Back to Top
amal View Drop Down
Admin Group
Admin Group
Avatar

Joined: 22 November 2005
Location: United States
Status: Offline
Points: 2061
Post Options Post Options   Thanks (0) Thanks(0)   Quote amal Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2007 at 8:33pm

Originally posted by willsterstyle willsterstyle wrote:

would it be possible to install two libraries and have two separate programs use one of the two?

Hmm, I seriously doubt it... I think the problem is that the drivers and the library are tied too closely together to allow both libraries to work at the same time. 

Amal ;)
www.amal.net
Back to Top
 Post Reply Post Reply Page  <12
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.188 seconds.