|
1 | | ---- |
2 | | -pcx_content_type: concept |
3 | | -title: Steps/tasks/procedures |
4 | | - |
5 | | ---- |
6 | | - |
7 | | -## Definition |
8 | | - |
9 | | -Action-oriented processes that outline steps to take and the order the steps should be taken. |
10 | | - |
11 | | -## Used in |
12 | | - |
13 | | -[How to](/style-guide/documentation-content-strategy/content-types/how-to/), [Tutorial](/style-guide/documentation-content-strategy/content-types/tutorial/) |
14 | | - |
15 | | -## Structure |
16 | | - |
17 | | -**Single-step procedures**: When a procedure consists of just one step, add the step into the introductory sentence. |
18 | | - |
19 | | -**Sub-steps in numbered procedures**: In a numbered procedure, sub-steps should be lowercase letters, and sub-sub-steps get lowercase Roman numerals. |
20 | | - |
21 | | -* When a step has sub-steps, treat the step like an introductory sentence. Put a colon or a period at the end of the step where appropriate. |
22 | | - |
23 | | -**Multi-action procedures**: Use one step per action. However, you can combine small actions into one step. |
24 | | - |
25 | | -**Multiple procedures for the same task**: If there is more than one way to complete a task, pick one procedure to document that is accessible for all users. If all of the procedures need to be documented, use separate headings or pages or tabs to separate the procedures to make it clear to the reader that this is an alternative way to complete the same task. |
26 | | - |
27 | | -The following guidelines can help you choose which procedure to document: |
28 | | - |
29 | | -* Choose a procedure that lets readers do all the steps using only a keyboard. |
30 | | -* Choose the shortest procedure. |
31 | | -* Choose a procedure that uses a programming language that the majority of your audience is familiar with. |
32 | | - |
33 | | -**Repetitive procedures**: Use concise procedures to avoid repetitiveness and overwhelming the user with a lot of bold UI elements. |
34 | | - |
35 | | -[Bullets vs. Numbered Lists](/style-guide/formatting/structure/lists/) |
36 | | - |
37 | | -**Post requisites**: Not used at this time. If you feel like you need a post requisites section, consider adding the task as the final step of a procedure or moving the content into Next steps. |
38 | | - |
39 | | -## Guidelines for writing procedures |
40 | | - |
41 | | -If the user must log in to the dashboard as a first step, consolidate logging in and navigation into the first step. Also, write "log in to" (three words) instead of "log into". |
42 | | - |
43 | | -If the user must press **Enter** after a step, then include that instruction as part of the step. |
44 | | - |
45 | | -If the user has to turn a setting on or off, use **enable**. |
46 | | - |
47 | | -State the purpose of the action before stating the action. |
48 | | - |
49 | | -Write in the order that the reader needs to follow. State the location of the action before stating the action. If there are multiple headings associated with a set of procedures, restate the location of the action in the first step of each procedure, even if the location is the same as in the previous procedure. |
50 | | - |
51 | | -Do not use "please." |
52 | | - |
53 | | -## Additional information |
54 | | - |
55 | | -Use complete sentences. |
56 | | - |
57 | | -Use parallel structure. |
58 | | - |
59 | | -Use second person imperative. Refer to the Style Guide for guidance on when to use certain verbs (click, select, choose, etc). |
60 | | - |
61 | | -For an optional step, type (Optional) as the first word of the step. |
62 | | - |
63 | | -* For example: (Optional) Type an arbitrary string, to be delivered to the target address with each notification delivered over this channel. |
64 | | - |
65 | | -Do not include keyboard shortcuts. |
66 | | - |
67 | | -Do not use directional language to orient the reader, such as above, below, or right-hand side. This type of language does not work well for accessibility or for localization. If a UI element is hard to find, provide a screenshot. |
68 | | - |
69 | | -Use sentences like "The `<screen/page/card>` displays." wisely. |
70 | | - |
71 | | -:::note |
72 | | - |
73 | | -Usually, you only need this kind of helper sentence if the user ended up in an unexpected location, or if there was more than one possible target location, depending on the options that the user selected. |
74 | | - |
75 | | -As an alternative, consider adding the `<screen/page/card>` mention at the beginning of the next step: "5. In `<screen/page/card>`, select Save." |
76 | | -::: |
| 1 | +// --- Global Device Configuration --- |
| 2 | +DEFINE DEVICE_ID = "IGUARD_14.4_BATTALION_001" |
| 3 | +DEFINE GPRS_APN = "your_gprs_apn" |
| 4 | +DEFINE SATELLITE_PROFILE = "your_satellite_profile" |
| 5 | +DEFINE ALERT_RECIPIENT_PHONE = "+1234567890" |
| 6 | +DEFINE ALERT_RECIPIENT_EMAIL = " [email protected]" |
| 7 | +DEFINE IMAGE_RESOLUTION = "1920x1080" |
| 8 | +DEFINE VIDEO_DURATION_ON_EVENT = "15_seconds" |
| 9 | +DEFINE MOTION_THRESHOLD = 50 // Sensitivity for motion sensor |
| 10 | +DEFINE HEARTBEAT_INTERVAL = 3600 // Send status every hour (seconds) |
| 11 | + |
| 12 | +// --- Initialize System --- |
| 13 | +FUNCTION setup() |
| 14 | + // Initialize Power Management |
| 15 | + CALL PowerManager.init() |
| 16 | + CALL PowerManager.monitorBattery() |
| 17 | + |
| 18 | + // Initialize Communication Modules |
| 19 | + CALL GPRS.init(GPRS_APN) |
| 20 | + CALL Satellite.init(SATELLITE_PROFILE) |
| 21 | + CALL GPS.init() |
| 22 | + |
| 23 | + // Initialize Sensors |
| 24 | + CALL Camera.init(IMAGE_RESOLUTION) |
| 25 | + CALL MotionSensor.init(MOTION_THRESHOLD) |
| 26 | + CALL IRSensor.init() |
| 27 | + CALL AcousticSensor.init() |
| 28 | + CALL EnvironmentalSensors.init() |
| 29 | + |
| 30 | + // Load saved settings from Flash Storage |
| 31 | + CALL ConfigManager.loadSettings() |
| 32 | + |
| 33 | + LOG("Device setup complete. Ready for operation.") |
| 34 | +END FUNCTION |
| 35 | + |
| 36 | +// --- Main Operating Loop --- |
| 37 | +FUNCTION loop() |
| 38 | + // Check for incoming commands (e.g., from command center) |
| 39 | + CALL CommsManager.checkIncomingCommands() |
| 40 | + |
| 41 | + // Monitor for motion events |
| 42 | + IF MotionSensor.detectMotion() THEN |
| 43 | + CALL handleMotionEvent() |
| 44 | + END IF |
| 45 | + |
| 46 | + // Monitor for acoustic events |
| 47 | + IF AcousticSensor.detectSoundEvent() THEN |
| 48 | + CALL handleAcousticEvent() |
| 49 | + END IF |
| 50 | + |
| 51 | + // Perform scheduled tasks |
| 52 | + CALL performScheduledTasks() |
| 53 | + |
| 54 | + // Sleep for a short period to save power |
| 55 | + CALL System.sleep(100_milliseconds) |
| 56 | +END FUNCTION |
| 57 | + |
| 58 | +// --- Event Handlers --- |
| 59 | +FUNCTION handleMotionEvent() |
| 60 | + LOG("Motion detected! Capturing evidence.") |
| 61 | + CALL IRSensor.activate() // Ensure night vision is ready |
| 62 | + |
| 63 | + // Capture Image |
| 64 | + IMAGE eventImage = Camera.captureImage() |
| 65 | + CALL StorageManager.saveImage(eventImage) |
| 66 | + CALL CommsManager.sendAlert(ALERT_RECIPIENT_EMAIL, "MOTION ALERT", "Motion detected at " + GPS.getLocation(), eventImage) |
| 67 | + |
| 68 | + // Capture Video (if configured) |
| 69 | + VIDEO eventVideo = Camera.recordVideo(VIDEO_DURATION_ON_EVENT) |
| 70 | + CALL StorageManager.saveVideo(eventVideo) |
| 71 | + // Send video via GPRS/Satellite (might be large, could send thumbnail first) |
| 72 | + // CALL CommsManager.sendVideo(ALERT_RECIPIENT_EMAIL, "MOTION VIDEO", eventVideo) |
| 73 | + |
| 74 | + CALL IRSensor.deactivate() |
| 75 | +END FUNCTION |
| 76 | + |
| 77 | +FUNCTION handleAcousticEvent() |
| 78 | + LOG("Significant sound event detected! Analyzing.") |
| 79 | + // Depending on sophistication, could classify sound (e.g., gunshot, vehicle) |
| 80 | + STRING soundType = AcousticSensor.analyzeSound() |
| 81 | + |
| 82 | + IF soundType == "GUNSHOT" OR soundType == "EXPLOSION" THEN |
| 83 | + IMAGE eventImage = Camera.captureImage() |
| 84 | + CALL StorageManager.saveImage(eventImage) |
| 85 | + CALL CommsManager.sendAlert(ALERT_RECIPIENT_PHONE, "CRITICAL ACOUSTIC ALERT: " + soundType, "Event at " + GPS.getLocation(), eventImage) |
| 86 | + END IF |
| 87 | +END FUNCTION |
| 88 | + |
| 89 | +// --- Scheduled Tasks --- |
| 90 | +FUNCTION performScheduledTasks() |
| 91 | + IF System.currentTime() % HEARTBEAT_INTERVAL == 0 THEN |
| 92 | + CALL sendHeartbeat() |
| 93 | + END IF |
| 94 | + |
| 95 | + // Check for software updates |
| 96 | + IF ConfigManager.isUpdateAvailable() THEN |
| 97 | + CALL updateFirmware() |
| 98 | + END IF |
| 99 | + |
| 100 | + // Manage storage (e.g., delete oldest files if full) |
| 101 | + CALL StorageManager.manageStorage() |
| 102 | +END FUNCTION |
| 103 | + |
| 104 | +FUNCTION sendHeartbeat() |
| 105 | + LOCATION currentLocation = GPS.getLocation() |
| 106 | + BATTERY_STATUS currentBattery = PowerManager.getBatteryStatus() |
| 107 | + ENVIRONMENTAL_DATA envData = EnvironmentalSensors.readData() |
| 108 | + |
| 109 | + STRING statusMessage = "Device " + DEVICE_ID + " OK. Loc: " + currentLocation.latitude + "," + currentLocation.longitude + |
| 110 | + " Bat: " + currentBattery.level + "%. Temp: " + envData.temperature + "C." |
| 111 | + |
| 112 | + // Try GPRS first, fall back to Satellite if GPRS fails |
| 113 | + IF GPRS.isAvailable() THEN |
| 114 | + CALL GPRS.sendMessage(ALERT_RECIPIENT_EMAIL, "HEARTBEAT", statusMessage) |
| 115 | + ELSE IF Satellite.isAvailable() THEN |
| 116 | + CALL Satellite.sendMessage(ALERT_RECIPIENT_EMAIL, "HEARTBEAT", statusMessage) |
| 117 | + ELSE |
| 118 | + LOG_ERROR("Heartbeat failed: No communication link available.") |
| 119 | + END IF |
| 120 | +END FUNCTION |
| 121 | + |
| 122 | +// --- Communication Management (Simplified) --- |
| 123 | +MODULE CommsManager |
| 124 | + FUNCTION checkIncomingCommands() |
| 125 | + // Poll GPRS for commands |
| 126 | + // Poll Satellite for commands |
| 127 | + // Parse commands (e.g., "TAKE_PIC", "CHANGE_SETTING", "REQUEST_STATUS") |
| 128 | + // Execute corresponding actions |
| 129 | + END FUNCTION |
| 130 | + |
| 131 | + FUNCTION sendAlert(recipient, subject, message, attachment = NULL) |
| 132 | + // Prioritize GPRS for speed, fall back to Satellite for reliability |
| 133 | + IF GPRS.isAvailable() THEN |
| 134 | + CALL GPRS.sendData(recipient, subject, message, attachment) |
| 135 | + ELSE IF Satellite.isAvaila |
0 commit comments