QuickStart Guide to: Barcode Scanning on Janam XP PalmOS Scanners
The Janam XP20 and XP30 scanners from Janam Technologies are rugged PalmOS handhelds with integrated barcode scanning capability. This QuickStart Guide shows you how to add Janam XP barcode scanning support to your Satellite Forms application, quickly and easily.
This QuickStart Guide contains plenty of screenshots to guide you through the process step by step, but don't let the length of this article scare you: the entire process of building the barcode scanning test application for the Janam XP scanners should only take about 15 minutes.
In order to control the Janam barcode scanner, we'll utilize the Symbol Integrated Scanner control extension that is included with Satellite Forms. Why the Symbol scanner control and not a Janam scanner control? Well, the Janam engineers brilliantly implemented their barcode support to be completely compatible with applications written to use the Symbol PalmOS barcode scanners, and therefore the Satellite Forms Symbol Integrated Scanner control works perfectly with the Janam scanners! This means that your application can support both the modern Janam XP scanners as well as the older Symbol SPT PalmOS scanners without any extra coding.
Okay, let's build a Janam Scan Test sample application step by step:
Step 1. Start a new project in Satellite Forms MobileApp designer, and select the default Palm platform target. A default form named Form 1 will be created, ready for you to add controls to. Click in the middle of the form, so that the Control Palette Toolbar becomes active. Let's add a form Title control, with the title text set to Janam Scan Test. Next add a text control with the label Barcode: and below that add an edit control named edBarcode that stretches across the width of the form. Let's add another text control below that labeled Type:, and below that another edit control named edBarcodeType that also stretches across the form. Your form should look like this:
Step 2. The next step is to add the Symbol Integrated Scanner control extension to our project. Click on the Manage Extensions toolbar icon which looks like this: A list of available extensions is displayed. Do not select the one at the top named Bar Code Reader. Scroll down to the bottom of the list, and select the Symbol Integrated Scanner extension, then click OK:
Step 3. The Symbol Integrated Scanner extension is a custom SFX control, and not just a plugin script extension. Although it is a custom control, the control is not actually visible to the end user: it is only visible in form design view of MobileApp Designer. Because it is a custom control, an icon is added to the Control Palette toolbar so that you can click on the icon to add the control to your forms. The SFX icon looks like this and is added to the right end of the Control Palette toolbar. If you do not see it, there's a good chance that part of the Control Palette toolbar is simply being cut off because the MobileApp Designer window is not wide enough. That's easy to solve, we'll just grab the Control palette toolbar "handle" and drag it down to the next line in the MobileApp Designer desktop. Now we can see all the Control palette toolbar icons, like this:
Okay good, we can see all the toolbar icons now.
So, click on the SFX custom control toolbar icon so that we can add it to our form. It's possible you might have more than one custom control on a form and they all share the same toolbar icon, so a selection box appears to let you choose the custom control you want, like this:
Click OK to select it, and the control then appears on our form as a little barcode symbol. Remember, this custom control is not visible to the end user. Let's move it out of the way so it does not overlap other controls, so your form should now look like this:
The default name that appears for the scanner control is BarCode1, and we'll leave it at that default. With the scanner control selected, click the Edit Action button in the control properties, and select Run Script from the Action Type droplist. This is the OnClick script for the scanner control, and this event will be fired when a barcode is scanned.
Step 4. Alright, now we're getting into the thick of things: here is where we decide what to do when a barcode is scanned. Click on Edit Script and the blank script editor window will open up. In this script, we are going to use script methods of the scanner control to obtain the barcode data that was scanned and place it into the edBarcode edit control on the form. Let's display the barcode type into the edBarcodeType control as well, so we can see what kind of barcode was scanned. We'll play a high pitched confirmation beep to indicate the successful scan, or a low frequency buzz if the scan was not successful. Here's the script code to type in (feel free to copy & paste right from this QuickStart Guide article):
'the OnClick event is fired when a barcode is scanned
'if a good scan is received then put it into the
'edBarcode edit field elsesound a failure tone
if BarCode1.TermRecd then
'put barcode into edit control
edBarcode = BarCode1.GetScan(0)
'what type of barcode was it
edBarcodeType = BarCode1.GetType
'good read tone
Tone(3800, 150, 64)
else
'bad read tone
Tone(220, 500, 64)
endif
Step 5. Okay, that is the bulk of it, but we need to do a couple more things to make barcode scanning work. What we need to do is to make sure the device we're running on is really a Janam (or Symbol) barcode scanner, and if so, enable the scanner to be used. We also need to disable the scanner when we leave the form. So, in the form AfterOpen event script that gets fired when the form is opened, enable the scanner like this:
'if device is Symbol or Janam scanner then
'enable scanner in the AfterOpen event and
'disable scanner in the BeforeClose event
if IsSymbolUnit = True then
'enable scanning
BarCode1.EnableScanner
else
'warn user about no scanner
edBarcode = "Barcode scanner not found"
endif
And in the form BeforeClose event, disable the barcode scanner like this:
'if device is Symbol or Janam scanner then
'disable scanner in the BeforeClose event
if IsSymbolUnit = True then
'disable scanning
BarCode1.DisableScanner
endif
That's about it for the barcode scanning stuff. Let's give the application a name, compile it, and test it out on the handheld.
Step 6. Click on the Edit > Project Properties menu, and give our application the name Janam Scan Test, like this:
Click OK, and then save your project. Name it Janam Scan Test.sfa.
Now, compile the application by pressing the F7 hotkey (Rebuild All). If the compiler finds any typos, fix them, and then Rebuild All again. Next, use the Handheld > Download App & Tables menu option (or press the F5 hotkey) to send the application to your Janam scanner device. Connect the Janam XP to the cradle or sync cable, and start the hotsync from the handheld. Assuming you've already installed the Satellite Forms SDK runtime engine on the Janam, your application will be sent to the device during the hotsync. Launch the SatForms SDK app on the handheld, select Janam Scan Test from the list, and you are ready to scan.
Point the scanner at a nearby barcode, press one of the front or side scan buttons on the Janam XP unit, and you the scanner should read the barcode and play a confirmation beep. Here's a sample screenshot from the Janam XP30 color screen:
Congratulations! You've just learned how to scan barcodes on Janam XP scanners with Satellite Forms!
There are plenty of additional functions in the scanner control to give you even more detailed control over the scanning process, but you've got the basic scanning function covered just by applying what you learned in the QuickStart Guide above.
Additional Sample Projects:
\Satellite Forms 7\Samples\Projects\Symbol Control App\ScannerDemo\SimpleScannerDemo.sfa
\Satellite Forms 7\Samples\Projects\Symbol Control App\Barcode\SymbolBarcode.sfa
\Satellite Forms 7\Samples\Projects\Symbol Control App\Function Test\SymbolFunctionTest.sfa
Keywords: Janam, XP, XP20, XP30, Symbol, barcode, scanner, quickstart, PalmOS
KB ID: 10077
Updated: 2008-05-27
Satellite Forms KnowledgeBase Online