Guide / Controls / Media

Scanner

Scan a barcode or QR code

When to use it. A live camera cell (Pro) that scans QR codes, barcodes, and printed text the moment they enter the frame, and can capture snapshots on demand. Detections fire the control's action over the mesh immediately — point the camera at a code and the data is already on your server.

Type
camera
Also titled
Camera
Default size
3 rows × 4 columns
Symbol
camera.viewfinder
Docs
Docs complete
Search for it as
  • photo
  • picture
  • scan
  • capture
  • video
  • webcam
Scanner: Live QR intake — the moment a code is seen, it's on the mesh
Rendered by the app

Fields

13 fields you can set on a camera control. Every control also takes the shared fields (id, position, span, sync, action).

Fields
FieldTypeDefaultWhat it does
Titlelabeltext—

The name shown on top

Shows this text as the header above the camera.

Scans forscanlistone of 4[barcode]

What the camera looks for

Chooses whether the live viewfinder reads barcodes, printed text, or both.

  • { value: barcode
  • since: next }
  • { value: text
  • since: next }
Barcode typessymbologieslistone of 36—

Which barcode types to read

Limits scanning to the listed barcode types; leave empty to read every supported type.

  • { value: qr
  • since: next }
  • { value: microQR
  • since: next }
  • { value: ean13
  • since: next }
  • { value: ean8
  • since: next }
  • { value: upce
  • since: next }
  • { value: gs1DataBar
  • since: next }
  • { value: gs1DataBarExpanded
  • since: next }
  • { value: gs1DataBarLimited
  • since: next }
  • { value: aztec
  • since: next }
  • { value: dataMatrix
  • since: next }
  • { value: pdf417
  • since: next }
  • { value: microPDF417
  • since: next }
  • { value: code128
  • since: next }
  • { value: code39
  • since: next }
  • { value: code93
  • since: next }
  • { value: itf14
  • since: next }
  • { value: i2of5
  • since: next }
  • { value: codabar
  • since: next }
Send whensendModechoiceone of 2auto

Send on its own or on tap

Decides whether detections send themselves or wait for you to tap one.

  • auto defaultevery steady detection is sent on its own and is the default
  • taponly the item you tap in the viewfinder is sent
debouncedebouncenumber0–30step 13

Wait before a repeat scan

Holds back the same scanned value from firing again for this many seconds (0 to 30).

Torchtorchon / offtrue (on)

Show the flashlight button

Shows a torch toggle in the viewfinder while scanning.

Snapshotsnapshoton / offfalse (off)

Show a photo button

Shows a shutter button that takes a photo while the camera is running.

Photo actionsnapshotActionobject—

What happens when you take a photo

Runs this command with the photo each time the shutter is pressed.

Vibration on scanhapticchoiceone of 9light

The buzz you feel on a scan

Plays this haptic on the phone each time a detection is sent.

  • light defaulta faint tick
  • mediuma normal tap
  • heavya firm thump
  • rigida firm sharp click
  • softa gentle cushioned tap
  • successa short double-tap for done
  • warninga sharper alert buzz
  • errora harsh triple buzz
  • selectiona tiny click like scrolling a picker
Symbolicontext—

The picture on the start card

Draws this SF Symbol on the Tap to Start card instead of the camera glyph.

snapshotQualitysnapshotQualitynumber0–1step 0.050.6

How sharp the photo is

Sets the photo's JPEG quality from 0 to 1; it is lowered automatically if the photo is too big to send.

snapshotMaxDimensionsnapshotMaxDimensionnumber240–4096step 11280

Biggest photo size

Caps the photo's longest side, 240 to 4096 pixels.

Title shownhideLabelon / offfalse (off)

Hide the title

Hides the header title, and the LIVE chip moves into the viewfinder.

Theme fields

Restyle one control by setting these in its theme object; a layout's theme sets them for every control.

Theme fields
FieldTypeDefaultWhat it does
accentColortheme.accentColorcolor#667eea

Size of the title text

Sets the title text size from 8 to 24 pt.

Value text sizetheme.valueFontSizenumber8–48step 114

Size of the value text

Sets the value text size from 8 to 48 pt.

Emits and receives

What this control sends when you use it, and what it can show or follow when data arrives.

Emits

Emits
SendsWhenTypeWhat it sends
When the camera reads a code or textvaluedetectstring

the decoded code or recognised text

In auto mode a steady detection sends once, and the same value waits out the debounce before it can send again; in tap mode only the item you tap sends. The shutter, if on, sends the snapshot to its own action

Example: Sample A

Examples

3 examples, each one a control you can paste into a layout.

Live QR intake — the moment a code is seen, it's on the mesh

JSON 16 lines
{
  "type": "camera",
  "id": "intake-scanner",
  "position": [0, 0],
  "span": [3, 4],
  "label": "Scan Inventory",
  "scan": ["barcode"],
  "symbologies": ["qr", "ean13", "code128"],
  "debounce": 5,
  "action": {
    "method": "meshsocket",
    "mode": "broadcast",
    "event": "broadcast_request",
    "payload": { "msg_type": "inventory_scan", "code": "{{value}}", "kind": "{{kind}}" }
  }
}

Open in CAR-TER

Scanner: Live QR intake — the moment a code is seen, it's on the mesh
Rendered by the app

Live text capture (OCR), send only what the user taps

JSON 15 lines
{
  "type": "camera",
  "id": "serial-reader",
  "position": [0, 0],
  "span": [3, 4],
  "label": "Read Serial Number",
  "scan": ["text"],
  "sendMode": "tap",
  "action": {
    "method": "meshsocket",
    "mode": "broadcast",
    "event": "broadcast_request",
    "payload": { "msg_type": "serial_read", "text": "{{value}}" }
  }
}

Open in CAR-TER

Scanner: Live text capture (OCR), send only what the user taps
Rendered by the app

Snapshot to a hub dashboard

JSON 13 lines
{
  "type": "camera",
  "id": "site-cam",
  "position": [0, 0],
  "span": [3, 4],
  "label": "Site Photo",
  "snapshotAction": {
    "method": "meshsocket",
    "mode": "broadcast",
    "event": "broadcast_request",
    "payload": { "msg_type": "site_photo", "image_b64": "{{image}}", "w": "{{width}}", "h": "{{height}}" }
  }
}

Open in CAR-TER

A hub layout can render the photo with an Background control listening for site_photo (decode the base64 server-side, or serve it back as a URL).

Scanner: Snapshot to a hub dashboard
Rendered by the app

Try it on your phone

carterkit serves a small hub on your computer and pushes one example to CAR-TER on your iPhone or iPad. Pair once with the code it prints.

  1. Install the Python kit.

    pip install carterkit
  2. Show “Live QR intake — the moment a code is seen, it's on the mesh” on your phone.

    carterkit demo camera --example 'Live QR intake — the moment a code is seen, it'"'"'s on the mesh'
  3. Swap in any example name from this page, or leave --example off for the first one.

carterkit quickstart · Get CAR-TER

Privacy model

The camera never starts on its own. It renders as a "Tap to Start" card; only a tap on the control opens the viewfinder, a red LIVE chip shows the whole time it runs, and it stops automatically the moment the app leaves the foreground or the control scrolls off screen. A pushed or synced layout cannot turn the camera on remotely.

Substitution tokens

Scan detections fire action with:

  • {{value}} — the decoded string (QR payload, barcode digits, or recognized text)
  • {{kind}} — what was read: a symbology name (qr, ean13, …) or text

Snapshots fire snapshotAction with:

  • {{image}} — the JPEG as base64 (no data-URL prefix)
  • {{width}} / {{height}} — pixel dimensions

The control's stored value is the last scanned string, so Visibility conditions and Sync readback see it.

Behavior

  • Tap to start; LIVE chip while running; tap ✕ (or background the app) to stop
  • Detections are highlighted in the viewfinder; auto mode sends them as they stabilize, tap mode waits for a tap
  • The same value re-fires only after debounce seconds
  • Requires camera permission (prompted on first start) and a device with a camera + A12 or later; the cell shows a friendly message otherwise
  • Snapshots are size-capped (~500 KB JPEG) so they always fit a mesh frame; expect ~1 MB base64 on the wire
  • Shadow opacity — Base fields
  • Toggle expand — Action definition & {{value}} substitution
  • Background — Displaying (rather than reading) QR codes
  • Background — Rendering received snapshots on another device
  • Privacy Policy (Settings → About) — what leaves the device: nothing, except to your server

Generated from ControlDocs/camera.md. Something unclear or missing? Tell me.