This may assuredly be a problem with my scanner set up so forgive my Naivety .....
:sign0163:
I have garbled up the examples for AsyncScanSrv and Bluetooth enough to get it to work for my solution..
http://www.b4x.com/forum/basic4andr...als/7669-asyncstreams-tutorial.html#post43578
http://www.b4x.com/forum/basic4andr...ncstreams-two-activity-modules.html#post94451
AND of course
http://www.b4x.com/forum/basic4andr...etooth-bluetoothadmin-tutorial.html#post83697
My design per the articles referenced, was to be able to select a menu button which will allow the user to perform barcode scanning features.
Most importantly was the separation of the feature into a service module.
There will be multiple features available of this genre. Scan current location, Scan to load new batch of orders, etc etc.
In Summary I couldn't load up the BluetoothAdmin and Serial as in the examples, because I have other stuff going on in my activity_create. I do not want to force scan features on load but as afore stated per a menu or button invocation. (its currently in a menu but thats trivial) ...
I have the Mac Address Type 'NameAndMac' (two Strings) its instance "connectedDevice" the BluetoothAdmin and the serial in my process Globals of my activity.
Just like the samples---
Activity_Create as already mentioned is very busy and already very tired so the only addition in it, to this process is a menu item named ScanBatch---
By the way this menu item lists itself like seven times but its the only menu item I have defined !!!!!-- Anyone know why this is happening ??
The events section for the menus of course has the Case "ScanBatch" which calls my sub named ScanBatch
I have combined the processes from multiple subs from the examples here in to this calling sub from the menu selection:
Please advise and comment - I'm worried that this may not be correct...
The Admin_StateChanged
Admin_DeviceFound and the Admin_DiscoveryFinished
are the same as the examples.
Although the latter calls my serial object by my name for it ---> scanSerial. Connect(connectedDevice.Mac)
Then I of course start my service:
Again the code in my service matches the examples:
Empty Service_Create, in Service_Start check for IsInitialized Close or Init as needed
and in the NewData I call a sub back in the calling activity.. Works great....
THE PROBLEM-->
#1) The error.. I have tried
MsgReceived = BytesToString(Buffer, 0, Buffer.Length, "ISO-8859-1")
MsgReceived = BytesToString(Buffer, 0, Buffer.Length, "UTF-8")
Both result in the XML ERROR "The XML was improperly formatted.Please escape it if necessary."
#2) I'm REALLY Confused as to WHAT is REALLY GOING ON HERE --How much of this will I need to duplicate to create a couple more scan barcode type of features.... . I'm going to need to review this hodge podge for quite some time today to really get whats going on ... For example I'm trying to see what I can do to add another BarCode Scan function for lets say scan current location...
How much of this will I be able to use again versus recreate for the new
scan method. Wil it simply be a different Menu choice calling the same stuff, and I just proces the results differently. If So AWESOME !!!! WIN WIN WIN !!! I appreciate any and all insight or criticism .. :sign0085: :sign0104: :sign0089:
Is this old condition appropriate in this case: ?
Old 10-31-2007, 11:06 PM
Erel Administrator
Basic4ppc Founder
http://www.b4x.com/forum/questions-windows-mobile/1074-what-am-i-overlooking.html#post5570
This is not the value of SQLCmd.
There is a bug in the IDE that causes this message (it tries to parse the string as XML because of the > sign).
It is fixed in the next version.
You can check its value in the watches fields.
:sign0163:
I have garbled up the examples for AsyncScanSrv and Bluetooth enough to get it to work for my solution..
http://www.b4x.com/forum/basic4andr...als/7669-asyncstreams-tutorial.html#post43578
http://www.b4x.com/forum/basic4andr...ncstreams-two-activity-modules.html#post94451
AND of course
http://www.b4x.com/forum/basic4andr...etooth-bluetoothadmin-tutorial.html#post83697
My design per the articles referenced, was to be able to select a menu button which will allow the user to perform barcode scanning features.
Most importantly was the separation of the feature into a service module.
There will be multiple features available of this genre. Scan current location, Scan to load new batch of orders, etc etc.
In Summary I couldn't load up the BluetoothAdmin and Serial as in the examples, because I have other stuff going on in my activity_create. I do not want to force scan features on load but as afore stated per a menu or button invocation. (its currently in a menu but thats trivial) ...
I have the Mac Address Type 'NameAndMac' (two Strings) its instance "connectedDevice" the BluetoothAdmin and the serial in my process Globals of my activity.
Just like the samples---
Activity_Create as already mentioned is very busy and already very tired so the only addition in it, to this process is a menu item named ScanBatch---
By the way this menu item lists itself like seven times but its the only menu item I have defined !!!!!-- Anyone know why this is happening ??
The events section for the menus of course has the Case "ScanBatch" which calls my sub named ScanBatch
I have combined the processes from multiple subs from the examples here in to this calling sub from the menu selection:
Please advise and comment - I'm worried that this may not be correct...
B4X:
Sub ScanBatch
If Admin.IsInitialized = False Then
Admin.Initialize("admin")
scanSerial.Initialize("scanSerial")
End If
If Admin.IsEnabled = False Then
If Admin.Enable = False Then
ToastMessageShow("Error enabling Bluetooth adapter.", True)
Else
ToastMessageShow("Enabling Bluetooth adapter...", False)
'the StateChanged event will be soon raised
End If
Else
Admin_StateChanged(Admin.STATE_ON, 0)
End If
End Sub
The Admin_StateChanged
Admin_DeviceFound and the Admin_DiscoveryFinished
are the same as the examples.
Although the latter calls my serial object by my name for it ---> scanSerial. Connect(connectedDevice.Mac)
Then I of course start my service:
B4X:
Sub scanSerial_Connected (Success As Boolean)
ProgressDialogHide
Log("connected: " & Success)
If Success = False Then
Log(LastException.Message)
ToastMessageShow("Error connecting: " & LastException.Message, True)
Else
StartService(AsyncScanSrv)
End If
End Sub
Again the code in my service matches the examples:
Empty Service_Create, in Service_Start check for IsInitialized Close or Init as needed
and in the NewData I call a sub back in the calling activity.. Works great....
THE PROBLEM-->
#1) The error.. I have tried
MsgReceived = BytesToString(Buffer, 0, Buffer.Length, "ISO-8859-1")
MsgReceived = BytesToString(Buffer, 0, Buffer.Length, "UTF-8")
Both result in the XML ERROR "The XML was improperly formatted.Please escape it if necessary."
#2) I'm REALLY Confused as to WHAT is REALLY GOING ON HERE --How much of this will I need to duplicate to create a couple more scan barcode type of features.... . I'm going to need to review this hodge podge for quite some time today to really get whats going on ... For example I'm trying to see what I can do to add another BarCode Scan function for lets say scan current location...
How much of this will I be able to use again versus recreate for the new
scan method. Wil it simply be a different Menu choice calling the same stuff, and I just proces the results differently. If So AWESOME !!!! WIN WIN WIN !!! I appreciate any and all insight or criticism .. :sign0085: :sign0104: :sign0089:
Is this old condition appropriate in this case: ?
Old 10-31-2007, 11:06 PM
Erel Administrator
Basic4ppc Founder
http://www.b4x.com/forum/questions-windows-mobile/1074-what-am-i-overlooking.html#post5570
This is not the value of SQLCmd.
There is a bug in the IDE that causes this message (it tries to parse the string as XML because of the > sign).
It is fixed in the next version.
You can check its value in the watches fields.
Last edited: