-
Delphi Xe5 Serial Communication Protocols카테고리 없음 2020. 2. 22. 02:19
One of the new key features in XE6 is what Embarcadero has chosen to call App Tethering components - the only problem I initially had with the name was that it implied that mobile had to be involved in some way - which is not the case. Change the (Manager)Text property on the TTetheringManager to 'BarcodeReceiverManager', on the TTetheringAppProfile change the (Profile)Text property to 'BarcodeReceiver' and set the Manager property to point to the TTetheringManager.Since we want to send the received barcode to the active application, we just use a send key function - in this case I have just used the WinAPI keybdevent method - it would be more correct to use SendInput - but the barcodes consists of non-unicode characters.
For the letters we also need to send along the shift key.procedure SendKeys(const S: String);varI: Integer;beginfor I:= 1 to Length(S) dobeginif CharInSet(SI, 'A'.' Z') thenkeybdevent(VKSHIFT, 0, 0, 0);keybdevent(Ord(SI), MapVirtualKey(Ord(SI), 0),0, 0);keybdevent(Ord(SI), MapVirtualKey(Ord(SI), 0), KEYEVENTFKEYUP, 0);if CharInSet(SI, 'A'.' Z') thenkeybdevent(VKSHIFT, 0, KEYEVENTFKEYUP, 0);end;end. :) Yes, I think I share the same issue as the PhotoWall Sample - which I looked at when I tried out the tethering - if you look at the RefreshList in the sample, change it to only add VCLMediaReceiverApp in the LbWall - you still might end up connecting to a MediaReceiverApp - because TakePhotoManager.RemoteProfiles holds all the profiles of the pair managers - i guess.
Serial Communication Rs232
Well I will at least fix my example - and simplify them - one Manager, one Profile - no loops - Thanks. It seems that the 32-bit VCL is a false-positive at AVAST - that is a different kind of bug-checking. Hi, thanks.To keep things simple, I would just keep sending a string with the barcode and the quantity, separated by a # or ¤ (what ever separator char you prefer).
And then change the desktop 'receiver' to parse the string into 2 and send a tab or return - what ever needed in between.But since you are not limited to string - you could send a stream with whatever structure you like and parse and act upon that on the receiver end.Everything is possible - we might just not yet have figured out how:-D. It is not quite clear to me if you are also writing the barcode scanner yourself, or we are talking about a 'physical' USB connected barcode scanner. But what version of Delphi are you using? If it is just a barcode scanner that acts as keyboard input, then whatever window control that has focus and can receive keyboard input - like Word, Notepad or TEdit should work - unless your barcode scanner adds some value by not using the keyboard buffer, but sending maybe unicode strings - and your TEdit is a per-Delphi 2009 version (that being non-unicode). I would need a bit more detail - the reference to the 'java barcode scanner' did confuse me a bit.
Have you tried zxing and my example described above? Well my bet is on type differences between the receiver and the sender.