SoifGo: Short Manual for AI Assistants

Use this page when you cannot open the full reference SOIFGO_AI_CONTEXT.md (complete, much longer). Everything a beginner needs to go from an idea to a running page is here.

0. Rules for you

1. What SoifGo is

2. Get the app (if the user does not have it yet)

3. Create the first button (once)

A new project is empty. The order is fixed: folder, then page, then button. The top-left icon is the main menu; its first item switches between Play (run) and Edit (design). SoifGo always opens in Play.

StepActionWhat the user sees
1In Play, tap the top-left icon, then Edit.The icon becomes a Pause symbol. This is Edit.
2Top-left icon, then Select Design.The list shows only folder. This is normal.
3Tap folder and create a folder.A folder exists.
4Tap Page and create a New Page. Tapping Page alone is not enough.A page exists.
5Now Background, Button (max 40), SeekBar (max 10) and btnstartup appear.The list is complete.
6Tap Button.A button is placed on the page and is in move mode.
7Fix it in place: tap it, or tap the close icon at the top, or press the phone Back button.The button stays where it is.

If the user cannot see Button, the folder or the page does not exist yet. Go back to steps 3 and 4.

4. Make the button a WebView (first time only, in Edit)

  1. In Edit, select the button, then top-left menu, then Behavior, then Browser or HTML File.
  2. A Select Behavior dialog shows two choices: Open URL in Browser (a website, not needed here) and Open or Edit Local HTML File in WebView.Html. Choose the second.
  3. A list of sources follows: Create (+) (a default "Hello SoifGo" page), File Explorer (an HTML file from the phone), Sample (built-in examples) and Saved (pages saved earlier in the project). For a first start, recommend Create (+), confirm the name, and finish.
  4. Do not paste code here. This screen is not a code editor.

If the user's screen shows slightly different wording, follow what the screen shows; it is the same feature.

5. Paste the code (every time the code changes, in Play)

  1. Copy the full HTML you wrote.
  2. Top-left icon, then Play. Tap the WebView button. The WebView opens.
  3. Inside the WebView, tap its top-left menu, then Edit. No extra dialog appears. The code editor opens.
  4. In the editor's top-left menu choose Select All and Paste. The clipboard replaces the whole file.
  5. Right after pasting, tap the yellow ✖ at the top. It saves, leaves the editor and returns to the running page, which reloads with the new code. There is no need to wait.

5B. Let the AI design a whole Classic page (no HTML)

This is visible in the app under Edit, Select Design, Page. Give the Classic Context to the AI assistant, describe the page, and take the design code back from it.

6. What you deliver

7. Bridge rules (do not guess)

window.soifgo.CallSub('subName', true, arg1, arg2, arg3)

Subs your page calls

SubArguments after truePurpose
html_bluetooth_rx1: textSEND text to Bluetooth (the name looks swapped, it is correct). By default SoifGo adds CR+LF.
bluetooth_eol1: modeLine ending added by html_bluetooth_rx: 'CRLF' (default), 'CR', 'LF', 'STXETX', 'NULL', 'NON'. Call once in window.onload before sending; it resets to CRLF when the WebView closes.
sensor_light0Activate light sensor
sensor_move0Activate accelerometer (X, Y and Z)
sensor_magno0Activate magnetometer (X, Y, Z)
sensor_barometer0Activate barometer (air pressure)
camera_permission0Ask for camera permission. The answer arrives in html_camera_status. Call getUserMedia only after 'true'.
connecte_mqtt_ai2: address, idMQTT connect, step 1
connecte_mqtt_up2: username, password (both non-empty)MQTT connect, step 2 (optional)
mqtt_retained1: 1 or 0Retained option for the next publish. Call before mqtt_publish.
mqtt_publish3: topic, message, qosPublish (also auto-subscribes to the topic)
mqtt_Disconnect0Disconnect MQTT
mqtt_status0Check MQTT status
api_send3: address, key, valueAPI POST
api_recive2: address, keyAPI GET (the spelling "recive" is correct)

Receivers SoifGo calls in your page (attach to window)

FunctionArgumentsPurpose
html_bluetooth_txdataRECEIVE Bluetooth text (the name looks swapped, it is correct)
html_sensor_lightdataLight value (integer, as string)
html_sensor_movexdataMovement X (3 decimals, as string)
html_sensor_moveydataMovement Y (3 decimals, as string)
html_sensor_movezdataMovement Z (3 decimals, as string). Axis perpendicular to the screen; not for tilt
html_sensor_magnoxdataMagnetic X (3 decimals, as string)
html_sensor_magnoydataMagnetic Y (3 decimals, as string)
html_sensor_magnozdataMagnetic Z (3 decimals, as string)
html_sensor_barometerdataBarometer / air pressure (hPa, 3 decimals, as string)
html_camera_statusdataThe string 'true' or 'false': result of the camera permission; compare with === 'true'
mqtt_rxtopic, messageMQTT message
html_mqtt_statusconnectedThe string 'true' or 'false'; compare with === 'true'
api_rxnumberAPI response (a plain value or a Map string like {usd=86750}; handle both)

Minimal Bluetooth page

<button onclick="send('ON')">ON</button>
<button onclick="send('OFF')">OFF</button>
<pre id="log"></pre>
<script>
function send(t) {
  if (window.soifgo) { window.soifgo.CallSub('html_bluetooth_rx', true, t); }
}
window.html_bluetooth_tx = function (data) {
  document.getElementById('log').textContent += data + '\n';
};
</script>

8. Limits to remember

9. More