Table of Contents

Introduction


At its core, CNS Barcode is an app for scanning and generating barcodes. You can use this app for a variety of barcodes.

The power behind CNS Barcode is not just scanning and generating barcodes. CNS Barcode can be launched from other iOS apps on your device to extend those apps with these features. You will find just how powerful CNS Barcode can be in the following sections.

Standalone Features


When you start CNS Barcode from your home screen, the first tab allows you to scan barcodes using the built-in camera or from photos in your photo library. The default behavior after scanning a barcode is to copy the data from the barcode onto your clipboard. Using this default behavior, you can scan a barcode and then switch to another app to paste that data into it. You can optionally copy the barcode image you scanned onto the clipboard along with the data from the barcode. With this option turned on, if the app you are pasting into can only accept text, it will only paste in the data from the barcode. However, if the app you are pasting into can accept images, it will paste in an image of the barcode.

If the barcode you scan contains a URL, CNS Barcode will ask if you want to launch the URL. The app can also be set to launch a URL automatically without prompting you. The type of URL in a barcode is not limited to a website. A URL can be used to create an email message, create an sms, dial a phone number, or launch and interact with other iOS apps you have on your device.

In addition to simply copying barcode data to the clipboard, CNS Barcode includes a Profile system which allows you to manage how the app processes a barcode. With a Profile, explained in detail below, you can define a Launch URL used to launch another app with the data from a scanned barcode.

A Default Profile is included with CNS Barcode that will launch Safari and perform a Google* search on the barcode data. To test this Profile, go to the Settings tab, tap the "Use Scanning Profile" setting, and select the 'Default' Profile.

Another option when starting CNS Barcode from your home screen is to generate barcodes. Use the Generate tab to define the type of barcode and the data to encode into the barcode. After generating a barcode, you can copy it to your clipboard or save it to your photo library.

Profiles


CNS Barcode allows you to create any number of Profiles that tell the app what to do with the barcode data you scan or with the barcodes you generate. You can create these Profiles on the Settings tab or with a cnsbarcode://addprofile URL. Profiles have the following settings:

Name

Each Profile must have a unique name so that you can specify it with a cnsbarcode:// URL.

Launch URL

CNS Barcode will launch this URL after you scan or generate a barcode. When entering the Launch URL for a Profile, you use the placeholder '::barcode::' to let CNS Barcode know where the data from the barcode you scanned or generated should be placed. For example, the Default Profile uses the URL: 'http://google.com/m/search?q=::barcode::'. If you scan a barcode with the value '1234', CNS Barcode will launch the URL: 'http://google.com/m/search?q=1234'. When you generate a barcode, the data used to generate the barcode is placed where '::barcode::' appears in the URL.

Scan multiple barcodes

When this option is turned on, CNS Barcode will keep the camera view open after scanning a barcode to allow you to scan more than one barcode. When you are done scanning, you press the 'Done' button. CNS Barcode will then place all the barcodes you scanned onto the clipboard, one per line, and then launch the Launch URL. If any of the barcodes you scan have Carriage Returns or Line Feeds in the data, CNS Barcode replaces them with ::CR:: and ::LF:: respectively. This is to keep the data from each barcode on its own line on the clipboard.

Return multiple in URL

When this option and the 'Scan multiple barcodes' option are both on, CNS Barcode will return the data from multiple scans in the Launch URL instead of on the clipboard. Carriage Returns and Line Feeds found in barcode data are still replaced with '::CR::' and '::LF::' respectively. Multiple barcodes are separated with '::RS::'. (Warning: This may fail if you are scanning many barcodes or if the barcodes contain a lot of information.)

Copy barcode to Clipboard (Scanning Options)

When this option is turned on, CNS Barcode will place an image of the barcode you scanned onto the clipboard. It still places the actual barcode data in the Launch URL before launching it. This option is ignored if the Scan multiple barcodes option is turned on.

Save barcode to Photos (Scanning Options)

When this option is turned on, CNS Barcode will save an image of the barcode you scanned into your Photo Library. It still places the actual barcode data in the Launch URL before launching it. This option is ignored if the Scan multiple barcodes option is turned on.

Flashlight (Scanning Options)

When this option is turned on, the LED Flashlight will be on automatically when you start scanning.

Use front Camera (Scanning Options)

When this option is on, the front-facing Camera will be active when you start scanning.

Return errors (Scanning Options)

When this option is turned on, CNS Barcode will launch the Launch URL even if the user cancels the scanning operation or if there is some other error. Before CNS Barcode launches the Launch URL, it will replace the '::barcode::' placeholder with either '::CANCELLED::' (if the user cancelled the scan) or '::ERROR::' followed by an error message if there was an error. When this option is turned off, the user remains in the CNS Barcode app if they cancel the scanning operation or if there is some other error.

Use High Resolution (Scanning Options)

On devices with 5MP+ cameras, use this option to put the camera in a high resolution mode for scanning small-scale barcodes. (Note: Because the app will be processing almost four times the amount of image data, this option will slow down scanning. You should only turn on this option if you need to scan small-scale barcodes.)

Copy barcode to Clipboard (Generating Options)

When this option is turned on, CNS Barcode will place the generated barcode onto the clipboard after it is generated.

Save barcode to Photos (Generating Options)

When this option is turned on, CNS Barcode will save the generated barcode into your Photo Library after it is generated.

Return errors (Generating Options)

When this option is turned on, CNS Barcode will launch the Launch URL even if there is an error generating the barcode. Before CNS Barcode launches the Launch URL, it will replace the '::barcode::' placeholder with '::ERROR::' followed by an error message. When this option is turned off, the user remains in the CNS Barcode app when there is a generation error.

Delete Profile

Use this button to delete the Profile you are viewing.

cnsbarcode URL Scheme


Other apps you have on your device can launch CNS Barcode using the cnsbarcode:// URL Scheme. This is a very powerful feature that allows you to add the functionality of scanning and generating barcodes to any app that can launch URLs and in turn be launched by a URL. An example of such an app is FileMaker Go. With a specially designed FileMaker Go database, you could, for example, press a button to launch CNS Barcode, scan a product barcode, and have CNS Barcode launch a URL to run a script in FileMaker Go. The FileMaker Go script could then use the barcode data to add a product to an invoice or locate an item in your product database.

The cnsbarcode:// URL Scheme is easy to use and several examples are included in the sections below.

Scanning Barcodes with cnsbarcode://scan


Use the 'scan' action to launch CNS Barcode for scanning a barcode. The format of the cnsbarcode://scan URL is as follows (items in square brackets are optional):

cnsbarcode://scan[?<parameter name>=<parameter value>[&<parameter name>=<parameter value>[&...]]]

The parameter names and possible values are defined below. None of them are required. If you specify a Profile with the 'profile' parameter, the 'launchurl' parameter and all of the 'scanXXX' parameters will be ignored. If you do not specify one of the 'yes'/'no' parameters, they all default to 'no'.

Parameters


  • profile
    This is the name of the Profile you want CNS Barcode to use for processing barcodes you scan.
  • method
    CNS Barcode will automatically bring up the camera view to scan barcodes with the built-in camera. However, you can specify the 'photo' method to automatically open the photo picker.
  • launchURL
    This is the URL CNS Barcode will launch after scanning a barcode. This must be URL encoded if there are any special characters in it. (See below for more information.)
  • scanMultiple
    Specify 'yes' to enable scanning multiple barcodes.
  • scanReturnMultipleInURL
    Specify 'yes' to return the multiple scan data in the Launch URL instead of on the clipboard. (Warning: This may fail if you are scanning many barcodes or if the barcodes contain a lot of information.)
  • scanCopyImage
    Specify 'yes' to copy the scanned barcode to the clipboard. (This is ignored if 'scanmultiple' is set to 'yes'.)
  • scanSaveImage
    Specify 'yes' to save the scanned barcode to your Photo Library. (This is ignored if 'scanmultiple' is set to 'yes'.)
  • scanFlashlight
    Specify 'yes' to turn the flashlight on.
  • scanUseFrontCamera
    Specify 'yes' to use the front camera instead of the rear camera.
  • scanReturnErrors
    Specify 'yes' to have CNS Barcode launch the Launch URL when the user cancels a scanning operation or when some other error occurs instead of leaving the user in the CNS Barcode app.
  • scanBeep
    Specify 'yes' to hear a beep after each scan, or 'no' to silence the beep. (The default is to beep unless the application-wide setting is turned off.)
  • scanHiRes
    On devices with 5MP+ cameras, specify 'yes' to put the camera in High Resolution mode for scanning small-scale barcodes. (Note: Because the app will be processing almost four times the amount of image data, this option will slow down scanning. You should only turn on this option if you need to scan small-scale barcodes.)

Here are a few examples of cnsbarcode://scan URLs:


Open CNS Barcode using Defaults

This will open CNS Barcode and bring up the camera scanning feature. If a barcode is scanned, the app will use the Launch URL from the Default Profile if defined, otherwise it will copy the barcode data to the clipboard. If the Default Profile is set to None, CNS Barcode will attempt to open or launch any URLs it finds in the barcode.

cnsbarcode://scan

Specify a Profile

This will open CNS Barcode and bring up the camera scanning feature. If a barcode is scanned, the app will use the Launch URL from the 'Testing' Profile.

cnsbarcode://scan?profile=Testing

Automatically begin a Photo scan

This will open CNS Barcode and bring up the photo picker. If a barcode is scanned, the app will use the Launch URL from the 'Search' Profile.

cnsbarcode://scan?method=photo&profile=Search

Specify one-time settings

This will open CNS Barcode and bring up the camera scanning feature. You will be able to scan multiple barcodes and when you press the 'Done' button, it will launch the URL 'fmp://$/multiscan?script=scanresult'.

cnsbarcode://scan?scanmultiple=yes&launchurl=fmp://$/multiscan%3fscript%3dscanresult

Generating Barcodes with cnsbarcode://generate


Use the 'generate' action to launch CNS Barcode and generate a barcode. The format of the cnsbarcode://generate URL is as follows (items in square brackets are optional).

cnsbarcode://generate?type=<barcode type>&data=<barcode data>[&<parameter name>=<parameter value>[&...]]

The parameter names and possible values are defined below. The 'type' and 'data' parameters are required. Every other parameter is optional. If you specify a Profile with the 'profile' parameter, the 'launchurl' parameter and all the 'generateXXX' parameters will be ignored. If you do not specify one of the 'yes'/'no' parameters, they all default to 'no' with the exception of the 'generatecopyimage' parameter which defaults to 'yes'.

When using this feature to generate barcodes, there is no end-user interaction with the CNS Barcode app if a Launch URL is specified. The CNS Barcode app will swap to the front and almost immediately swap back to the original application. This can be a little disconcerting to an end-user. If you are developing a FileMaker Go database or some other application that needs to generate barcodes in this fashion, you should warn your users that their screen will swap out and back in during this process.

  • type
    This is the type of barcode to create. See the Barcode Types tab for the list of barcodes CNS Barcode can create. (Most of the names can be abbreviated.)
  • data
    This is the data to encode in the barcode. It must be the correct kind of data that can be encoded into the barcode type, otherwise an error will be generated.
  • profile
    This is the name of the Profile you want CNS Barcode to use after generating the barcode.
  • launchurl
    This is the URL CNS Barcode will launch after generating a barcode. This must be URL encoded if there are any special characters in it. (See below for more information.)
  • generatecopyimage
    Specify 'no' to prevent CNS Barcode from copying the generated barcode to the clipboard.
  • generatesaveimage
    Specify 'yes' to save the generated barcode to your Photo Library.
  • generatereturnerrors
    Specify 'yes' to have CNS Barcode launch the Launch URL when there is an error generating a barcode instead of leaving the user in the CNS Barcode app.

Here are a few examples of cnsbarcode://generate URLs


Open CNS Barcode to the generate tab

This will open CNS Barcode to the Generate tab allowing you to manually enter in the Barcode Type and Barcode Data. You then can copy the image to the clipboard or save it to your Photo Library.

cnsbarcode://generate

Specify a Profile

This will generate a Code 128 barcode with the data 'ABC123' and then use the Profile named 'Save Barcode' to do something with the generated barcode.

cnsbarcode://generate?type=code128&data=ABC123&profile=Save%20Barcode

Specify one-time settings

This will generate a QR Code barcode with a telephone number embedded in it and then launch the URL 'fmp://$/qrcodes?script=paste%20barcode'.

cnsbarcode://generate?type=qrcode&data=tel://8175555555&launchurl=fmp://$/qrcodes%3fscript%3dpaste%2520barcode

Ask for errors

This will attempt to generate a UPC E barcode with the data '123abc'. However, since the UPC E barcode can only contain numbers, CNS Barcode will generate the error 'Invalid characters in data' and launch the URL 'fmp://$/products?script=save_barcode&param=::ERROR::Invalid%20characters%20in%20data'.

cnsbarcode://generate?type=upce&data=123abc&generatereturnerrors=yes&launchurl=fmp://$/products%3fscript%3dsave_barcode%26param%3d::barcode::

Adding Profiles with cnsbarcode://addprofile


Use the 'addprofile' action to launch CNS Barcode and add a new Profile. This allows other apps you have on your device to set up Profiles for you to use without you having to manually add them. The format of the cnsbarcode://addprofile URL is as follows (items in square brackets are optional):

cnsbarcode://addprofile?name=<parameter value>[&<parameter name>=<parameter value>[&...]]

The parameter names and possible values are defined below. You can specify all of them in the URL, or only the ones you need. The only required parameter is the 'name' parameter, which you use to reference the new Profile in other cnsbarcode:// URLs. If you do not specify one of the 'yes'/'no' parameters, they all default to 'no' with the exception of the 'generatecopyimage' parameter which defaults to 'yes'. Each of these parameters correspond to a Profile setting described in the Profiles section above.

When CNS Barcode is launched with a cnsbarcode://addprofile URL, it will present you with an 'Add Profile' screen for you to accept the new Profile. If you already have a Profile with the name of the new Profile, you will be prompted to overwrite it.

  • name
    This is the name for the Profile you are adding. If you want to include a space in the Profile name, use %20 in place of the space. (This is called URL encoding. See below for more information.)
  • launchurl
    This is the URL CNS Barcode will launch after scanning or generating a barcode. This must be URL encoded if there are any special characters in it. (See below for more information.)
  • scanmultiple
    Specify 'yes' to enable scanning multiple barcodes.
  • scancopyimage
    Specify 'yes' to copy the scanned barcode to the clipboard.
  • scansaveimage
    Specify 'yes' to save the scanned barcode to your Photo Library.
  • scanflashlight
    Specify 'yes' to turn on the light when scanning.
  • scanusefrontcamera
    Specify 'yes' to use the front camera instead of the rear camera.
  • scanreturnerrors
    Specify 'yes' to have CNS Barcode launch the Launch URL when the user cancels a scanning operation or when some other error occurs instead of leaving the user in the CNS Barcode app.
  • scanhires
    On devices with 5MP+ cameras, specify 'yes' to put the camera in High Resolution mode for scanning small-scale barcodes. (Note: Because the app will be processing almost four times the amount of image data, this option will slow down scanning. You should only turn on this option if you need to scan small-scale barcodes.)
  • scanbeep
    Specify 'yes' to hear a beep after each scan, or 'no' to silence the beep. (The default is to beep unless the application-wide setting is turned off.)
  • generatecopyimage
    Specify 'no' to prevent CNS Barcode from copying the generated barcode to the clipboard.
  • generatesaveimage
    Specify 'yes' to save the generated barcode to your Photo Library.
  • generatereturnerrors
    Specify 'yes' to have CNS Barcode launch the Launch URL when there is an error generating a barcode instead of leaving the user in the CNS Barcode app.

Here are a few examples of cnsbarcode://addprofile URLs:


Add a simple Profile

This adds a Profile named 'Testing' with the Launch URL 'http://google.com/m/search?q=::barcode::'.

cnsbarcode://addprofile?name=Testing&launchurl=http://google.com/m/search%3fq%3d::barcode::

Add a multi-scan Profile

This adds a Profile named 'MultiScan' that has the 'Scan multiple barcodes' option enabled and uses the Launch URL 'fmp://$/multiscan?fscript=scanresult'.

cnsbarcode://addprofile?name=MultiScan&scanmultiple=yes&launchurl=fmp://$/multiscan%3fscript%3dscanresult

Add a Profile for Generating Barcodes

This adds a Profile named 'Save Barcode' that will save a generated barcode to your Photo Library.

cnsbarcode://addprofile?name=Save%20Barcode&generatecopyimage=no&generatesaveimage=yes

URL Encoding


It is important to note that when specifying the 'name' and 'launchurl' parameters in a cnsbarcode:// URL, you must encode the values for CNS Barcode to correctly extract them. For the 'name' parameter, this usually means that if you want a space in the Profile Name, you have to replace it with '%20'. Though, if you are also wanting to include any of the punctuation below in your Profile Name, you will need to encode those punctuation marks as well.

The more difficult task is making sure the 'launchurl' parameter is encoded properly. This can seem a little difficult because you are specifying one URL inside of another URL. However, if you replace the following characters with their encoded equivalents, you should not have any problem:

  • % - %25
  • ? - %3f
  • & - %26
  • = - %3d

If the Launch URL you are encoding already contains encodings like these, you will end up with double-encodings. For example, if a URL looks like the following before encoding:

fmp://$/mydb?script=My%20Script¶m=something

Then after encoding, the URL will look like this:

fmp://$/mydb%3fscript%3dMy%2520Script%26param%3dsomething

Notice that there was already a %20 in the URL before encoding, so after encoding, it became %2520.

Remember, you only have to encode the Launch URLs like this when using them as the 'launchurl' parameter of a cnsbarcode:// URL. If you are manually typing in a Launch URL in the CNS Barcode Settings, you do not need to do all of this extra encoding.

Settings


The Settings tab allows you to define settings for CNS Barcode. Each section is described below:

Profiles - This section contains all the currently defined Profiles and provides you with a way to add new Profiles. If you no longer need a Profile, select it, and then press the 'Delete Profile' button at the bottom.

cnsbarcode:// Settings - This section contains the settings used when you start CNS Barcode with a cnsbarcode:// URL.

  • Default Scanning Profile - This is the Profile used for any cnsbarcode://scan URLs if one is not specified with the 'profile' parameter.
  • Default Generation Profile - This is the Profile used for any cnsbarcode://generate URLs if one is not specified with the 'profile' parameter.

Standalone Settings - This section contains the settings used when you start CNS Barcode from your home screen.

  • Auto Show URLs - Set to On to automatically show an embedded URL found in a barcode.
  • Copy Scanned Barcode - Set to On to copy the scanned barcode image, along with the barcode data, to the clipboard.
  • Use Scanning Profile - This setting allows you to define a Profile for CNS Barcode to use after scanning a barcode instead of simply copying the barcode data to the clipboard.
  • Use High Resolution - On devices with 5MP+ cameras, use this option to put the camera in a high resolution mode for scanning small-scale barcodes. (Note: Because the app will be processing almost four times the amount of image data, this option will slow down scanning. You should only turn on this option if you need to scan small-scale barcodes.)
  • Beep on Scan - Set to On to hear a beep after each scan.
  • Seconds Between Scans - The number of seconds to pause between scans to help prevent scanning the same barcode more than once.

Credits / Copyrights / Attributions


Comm-Unity Networking Systems is:

  • Daniel Sims: Beta testing, Technical Support
  • Jake Traynham: Concept, Design, Programming
  • Jesse Traynham: Concept, Design, Beta testing