Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connect to attendance machine

Status
Not open for further replies.

alaamokhtar

IS-IT--Management
Feb 23, 2012
2
0
0
EG

Alert me
|
Edit
Question
You cannot vote on your own post
0

I have an attendance machine and SDK for it

I use the next command for getting attendance log

ip="10.0.0.244"
machineno=1
d11=0
this.Parent.olecontrol1.setipAddress(@ip,5005,0)
MESSAGEBOX(this.Parent.olecontrol1.openCommPort(machineno))
this.Parent.olecontrol1.enableDevice(machineno,1)

MESSAGEBOX(this.Parent.olecontrol1.readgeneralLogCount(machineno,@d11))
MESSAGEBOX(d11)
MESSAGEBOX(this.Parent.olecontrol1.readgeneralLogData(@machineno))

the first messagebox return true

and the second return true

the third messagebox return the no of logs (300 logs)

but the third return false

so I can't get the 300 logs to my tables


when I use get error function and I get

error number =3

from ocx manual i know that error 3 mean An error has happened to receipt of the data

 
Even if we knew which attendance machine you have, we couldn't use it's SDK without having the hardware. The ole control reports an error in retrieving data, ask the machine vendor about what should be done. I'd assume configuration, maybe another license. It's not a FoxPro issue at all and there's nothing further we could do to help, can we?

My question would be, why you pass in machine no by ref into the readgeneralLogData method. A parameter is only passed by ref, if the method could change it (in/out) parameter, which seems weird if you rea the log of a certain machine, the machine no wouldn't change, would it?

Maybe you rather let some developer work for you and create a foxpro (function) library to wrap that SDK for your easier use. The developer would need hands on the device, most probably, and of course SDK manual etc.

Bye, Olaf.
 
Yes, I agree with Olaf. This is not a Foxpro issue. You will need to take it up with the support people of the hardware vendor.

In any case, your question is not particularly clear. For example, you wrote:

the third messagebox return the no of logs (300 logs)
but the third return false

It can't return both a number and false. That doesn't make sense. In general, messageboxes never return false. They return an integer which indicates which button has been clicked. But as that's not relevant in this case, I suspect you mean something different. You will need to clarify your question if you want a useful answer.

Mike





__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Yes Mike,

I guess 300 is returned via d11 in the call of readgeneralLogCount(machineno,@d11), the second messagebox then shows this 300. Then readgeneralLogData should return the net log data, instead of just the count, but that fails. Maybe because of config, maybe 300 log entries are already too much to read in one go. Whatever, several things are lost in translation here, not only regarding programming languages.

Bye, Olaf.
 
The first thing I would do is check that the attendance machine is on the same subnet as your VFP program, otherwise
you will probably be getting rubbish.

Secondly you are passing by reference to the control:

@d11 and @machineno

Which IMPLIES that the control is expected to update the two values perhaps.

So is it possible the second function should be returning a string into a buffer
of some sort?

Perhaps like this:
Code:
m.LogCount = this.Parent.olecontrol1.readgeneralLogCount(machineno,@d11)
m.LogDataBuffer= space(m.LogCount * 255)
this.Parent.olecontrol1.readgeneralLogData(machineno,@LogDataBuffer)
? m.LogDataBuffer

But, with just a tiny bit of googling I found this - which might point you in the right direction


It's all in pascal, for delphi presumably - but I suspect this is the kit you have and this has a number of functions
to help you read it.




Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top