ה-API /osc/commands/execute יריץ את הפקודות שצוינו במצלמה. הפלט הוא אובייקט פקודה.
קלט
שם
סוג
תיאור
name
מחרוזת
הפקודה שצריך לבצע.
parameters
אובייקט
הפרמטרים של הקלט של פקודות בהתאם למפרט של הגדרות הפקודות. דוגמאות מופיעות במפרט של OSC API.
פלט
שם
סוג
תיאור
name
מחרוזת
הפקודה שצריך לבצע.
state
מחרוזת
מצב הפקודה. צריכה להיות אחת מהאפשרויות הבאות:
done – הושלם, התוצאות הוחזרו בתשובה הזו.
inProgress – הביצוע עדיין מתבצע.
error – הפעולה נכשלה. יש שגיאה בתשובה.
id
מחרוזת (אופציונלי)
מזהה הפקודה. הערך הזה נדרש לפקודות שמחזירות את הסטטוסinProgress. לדוגמה, הפקודה camera.takePicture נמשכת כמה שניות בגלל הצורך בחיבור. פרטים נוספים זמינים בקטע 'סטטוס'.
results
אובייקט (אופציונלי)
תוצאות הפקודות. הערך הזה נדרש לפקודות שמחזירות את המצבdone אם הפקודה צפויה להחזיר תוצאות; לדוגמה,
“results” : {
"AAA": "BBB",
...
}
דוגמאות מופיעות במפרט של OSC API.
error
אובייקט (אופציונלי)
תיאור השגיאה של הפקודה. הערך הזה נדרש לפקודות שמחזירות את המצב error;, לדוגמה,
“error”:{ “code”:“missingParameter” }
progress
אובייקט (אופציונלי)
תיאור ההתקדמות של הפקודה. הערך הזה נדרש לפקודות שמחזירות את המצב inProgress; לדוגמה,
“progress”:{ “completion”:0.8 }
שגיאה
קוד שגיאה
תיאור
unknownCommand
הפקודה המבוקשת לא ידועה, למשל אם לקוח גרסה 2 (clientVersion מוגדר לערך 2 ראו Options) מבקש פקודה שהוצאה משימוש מרמת API 1, הבקשה אמורה להיכשל עם קוד השגיאה הזה.
disabledCommand
הפקודה שהרצתם מושבתת כרגע, למשל הפקודה 'TakePicture' מושבתת כאשר
המצלמה במצב וידאו, הפקודה ProcessingPicture מושבתת כשהמצלמה לא תומכת ב-dellProcessing. קוד השגיאה הזה נוסף ברמת API 2.
cameraInExclusiveUse
המצלמה כבר בשימוש בלעדי, אי אפשר להתחיל סשן חדש. קוד השגיאה הזה הוצא משימוש ברמת API 2.
missingParameter
אחד או יותר מהפרמטרים הנדרשים לא צוין.
invalidParameterName
לפחות פרמטר קלט אחד או שם אפשרות אחד לא זוהה או לא נתמך.
invalidParameterValue
שמות הפרמטרים או האפשרויות זוהו, אבל אחד או יותר מהערכים לא חוקיים. לדוגמה, הערך נמצא מחוץ לטווח.
דוגמה
בקשה (API 1)
POST /osc/commands/execute HTTP/1.1 Host:[camera ip address]:[httpPort] Content-Type: application/json;charset=utf-8 Accept: application/json Content-Length:{CONTENT_LENGTH} X-XSRF-Protected:1
[null,null,["עדכון אחרון: 2024-08-21 (שעון UTC)."],[[["The `/osc/commands/execute` API allows you to execute commands on the camera, such as adjusting settings or taking pictures."],["Input requires the command `name` and any necessary `parameters` defined in the OSC API Specification."],["Output provides the command `name`, `state`, and may include an `id`, `results`, `error`, or `progress` depending on the command and its execution status."],["Possible command states include `done`, `inProgress`, and `error`, with further details provided in the output fields."],["Refer to the OSC API Specification for specific command definitions, parameters, and result formats."]]],["The `/osc/commands/execute` API triggers commands on a camera, defined by a command `name` and associated `parameters`. The output indicates the command's `state` (`done`, `inProgress`, or `error`), an optional `id` for `inProgress` commands, `results` for completed commands, or `error` details. Possible errors include `unknownCommand`, `disabledCommand`, `missingParameter`, and `invalidParameterValue`. Example requests demonstrate how to set options and take a picture, with the responses showing command completion or ongoing progress.\n"]]