### C# Helper: Get Application Paths Source: https://context7.com/ispysoftware/ispy/llms.txt Retrieves essential application directory paths. This includes the main installation directory and the user-specific application data directory. ```csharp // Get application paths string appPath = Program.AppPath; // Installation directory string appDataPath = Program.AppDataPath; // User data directory (%AppData%\iSpy\) ``` -------------------------------- ### HTTP API: Start Camera Discovery Source: https://context7.com/ispysoftware/ispy/llms.txt Initiates a device scan using the iSpy HTTP API. This command requires an authentication token. It is used to discover cameras on the network. ```bash curl -X GET "http://localhost:8080/api/api.json?cmd=startdevicescan&token=YOUR_AUTH_TOKEN" ``` -------------------------------- ### Get Settings API Source: https://context7.com/ispysoftware/ispy/llms.txt Retrieves all server configuration settings, including general preferences, timeouts, and integrations with cloud storage and FTP services. ```APIDOC ## GET /api/settings.json ### Description Retrieve all server configuration settings including JPEG quality, CPU limits, timeouts, FTP servers, SMTP configuration, cloud providers, and storage locations. ### Method GET ### Endpoint /api/settings.json ### Query Parameters - **token** (string) - Required - Authentication token for the API request. ### Response #### Success Response (200) - **sections** (array) - An array of configuration sections, each with a header and a list of items. - **header** (string) - The title of the configuration section. - **items** (array) - A list of configuration items within the section. - **text** (string) - The display name of the setting. - **value** (any) - The current value of the setting. - **type** (string) - The data type of the setting (e.g., "Int32", "Boolean"). - **bindto** (string) - The internal property name for the setting. ### Response Example ```json { "sections": [ { "header": "General", "items": [ {"text": "JPEG Quality", "value": 80, "type": "Int32", "bindto": "JPEGQuality"}, {"text": "Max CPU Target", "value": 100, "type": "Int32", "bindto": "CPUMax"}, {"text": "Delete to Recycle Bin", "value": false, "type": "Boolean", "bindto": "DeleteToRecycleBin"} ] }, { "header": "Timeouts", "items": [ {"text": "Camera Receive Timeout", "value": 20000, "type": "Int32", "bindto": "IPCameraTimeout"}, {"text": "Server Timeout", "value": 1500, "type": "Int32", "bindto": "ServerReceiveTimeout"} ] } ] } ``` ``` -------------------------------- ### Retrieve Server Settings (API) Source: https://context7.com/ispysoftware/ispy/llms.txt Fetches all server configuration settings including JPEG quality, CPU limits, timeouts, FTP, SMTP, cloud providers, and storage details. Uses a GET request to the /api/settings.json endpoint. ```bash curl -X GET "http://localhost:8080/api/settings.json?token=YOUR_AUTH_TOKEN" \ -H "Accept: application/json" ``` -------------------------------- ### JSON: Discovered Camera Device Structure Source: https://context7.com/ispysoftware/ispy/llms.txt Example JSON structure representing a discovered camera device. It includes the device URL, make, model, username, and a list of available channels. ```json { "devices": [ { "url": "rtsp://192.168.1.100:554/stream", "make": "Hikvision", "model": "DS-2CD2042WD-I", "username": "", "channels": [0, 1] } ] } ``` -------------------------------- ### Schedule Recording via API (Bash) Source: https://context7.com/ispysoftware/ispy/llms.txt Configures time-based recording schedules using the iSpy API. This bash script demonstrates how to POST a JSON payload to the /api/editschedule.json endpoint to set recording start and stop times for specific days of the week. ```bash curl -X POST "http://localhost:8080/api/editschedule.json?ot=2&oid=0&token=YOUR_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "schedule": { "active": true, "entries": [ { "daysofweek": "1,2,3,4,5", "start": "08:00", "stop": "18:00", "recordondetect": true } ] } }' ``` -------------------------------- ### Query Motion or Audio Level (API) Source: https://context7.com/ispysoftware/ispy/llms.txt Retrieves the current motion level for cameras (typeID=2) or audio level for microphones (typeID=1). Uses a GET request to the /api/api.json endpoint with 'querylevel' command. ```bash curl -X GET "http://localhost:8080/api/api.json?cmd=querylevel&ot=2&oid=0&token=YOUR_AUTH_TOKEN" \ -H "Accept: application/json" ``` -------------------------------- ### POST /api/editschedule.json - Schedule Recording API Source: https://context7.com/ispysoftware/ispy/llms.txt Configures time-based recording schedules, specifying days of the week, start and stop times, and whether to record on detection. ```APIDOC ## Schedule Recording API ### Description Configure time-based recording schedules with day-of-week and time range specifications. ### Method POST ### Endpoint `/api/editschedule.json` ### Query Parameters - **ot** (integer) - Optional. Likely an object type identifier. - **oid** (integer) - Optional. Likely an object ID. - **token** (string) - Required. Authentication token. ### Request Body - **schedule** (object) - Configuration for the recording schedule. - **active** (boolean) - Whether the schedule is active. - **entries** (array) - An array of schedule entries. - **daysofweek** (string) - Comma-separated list of days of the week (e.g., "1,2,3,4,5" for Monday to Friday). - **start** (string) - Start time in HH:MM format. - **stop** (string) - Stop time in HH:MM format. - **recordondetect** (boolean) - Whether to record when motion is detected. ### Request Example ```bash curl -X POST "http://localhost:8080/api/editschedule.json?ot=2&oid=0&token=YOUR_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "schedule": { "active": true, "entries": [ { "daysofweek": "1,2,3,4,5", "start": "08:00", "stop": "18:00", "recordondetect": true } ] } }' ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### HTTP API: Get Camera Scan Results Source: https://context7.com/ispysoftware/ispy/llms.txt Retrieves the results of a previously initiated device scan using the iSpy HTTP API. This command also requires an authentication token and returns discovered devices in a JSON format. ```bash curl -X GET "http://localhost:8080/api/api.json?cmd=getdevicescan&token=YOUR_AUTH_TOKEN" ``` -------------------------------- ### Configure Cloud Provider Integration via API (Bash) Source: https://context7.com/ispysoftware/ispy/llms.txt Integrates media uploads with cloud storage services like Dropbox. This bash script demonstrates authorizing a provider and configuring camera settings for cloud uploads via the iSpy API. ```bash # Authorize cloud provider curl -X POST "http://localhost:8080/api/settings.json?action=authorise¶meter=dropbox&token=YOUR_AUTH_TOKEN" # Configure cloud upload for camera curl -X POST "http://localhost:8080/api/editcamera.json?oid=0&token=YOUR_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "settings": { "cloudprovider": { "provider": "Dropbox", "path": "/Security/FrontDoor", "recordings": true, "images": true } } }' ``` -------------------------------- ### Configure Audio Source via API (Bash) Source: https://context7.com/ispysoftware/ispy/llms.txt Adds and configures audio sources, such as microphones, for use with iSpy. This bash script utilizes the /api/editmicrophone.json endpoint to set up audio input with specified sensitivity and recording detection settings. ```bash curl -X POST "http://localhost:8080/api/editmicrophone.json?oid=0&token=YOUR_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Office Microphone", "settings": { "active": true, "typeindex": 3, "sourcename": "Default Audio Device" }, "detector": { "minsensitivity": 30, "maxsensitivity": 90, "recordondetect": true }, "alerts": { "active": true, "mode": "movement" } }' ``` -------------------------------- ### POST /api/editmicrophone.json - Audio Source Configuration Source: https://context7.com/ispysoftware/ispy/llms.txt Adds and configures audio sources, such as microphones, including sensitivity settings and recording triggers. ```APIDOC ## Audio Source Configuration ### Description Add and configure audio sources including microphones with sensitivity and recording settings. ### Method POST ### Endpoint `/api/editmicrophone.json` ### Query Parameters - **oid** (integer) - Object ID of the microphone to edit. - **token** (string) - Required. Authentication token. ### Request Body - **name** (string) - Name of the microphone (e.g., "Office Microphone"). - **settings** (object) - **active** (boolean) - Whether the audio source is active. - **typeindex** (integer) - Index representing the type of audio source. - **sourcename** (string) - The specific name of the audio source device. - **detector** (object) - Motion/Audio detection settings. - **minsensitivity** (integer) - Minimum sensitivity threshold. - **maxsensitivity** (integer) - Maximum sensitivity threshold. - **recordondetect** (boolean) - Whether to record upon detection. - **alerts** (object) - **active** (boolean) - Whether alerts are active for this audio source. - **mode** (string) - The mode for alerts (e.g., "movement"). ### Request Example ```bash curl -X POST "http://localhost:8080/api/editmicrophone.json?oid=0&token=YOUR_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Office Microphone", "settings": { "active": true, "typeindex": 3, "sourcename": "Default Audio Device" }, "detector": { "minsensitivity": 30, "maxsensitivity": 90, "recordondetect": true }, "alerts": { "active": true, "mode": "movement" } }' ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### Timestamp and Overlay Configuration Source: https://context7.com/ispysoftware/ispy/llms.txt Customizes video overlays, including timestamp formatting, colors, masks, and picture-in-picture (PiP) from other cameras. ```APIDOC ## Timestamp and Overlay Configuration ### Description Customize video overlays with timestamps, masks, and picture-in-picture from other cameras. ### Method Not specified (Likely PUT or POST to a configuration endpoint) ### Endpoint Not specified ### Request Body - **settings** (object) - **timestampformatter** (string) - Format string for the timestamp (e.g., "{FPS},{0:G},{CAMERA},{REC}"). - **timestampforecolor** (string) - Foreground color for the timestamp (e.g., "#FFFFFF"). - **timestampbackcolor** (string) - Background color for the timestamp (e.g., "#000000"). - **timestampshowback** (boolean) - Whether to show a background for the timestamp. - **timestampfont** (integer) - Font size for the timestamp. - **timestamplocation** (integer) - Location of the timestamp (specific values not detailed). - **maskimage** (string) - Filename of the mask image to overlay. - **pip** (object) - Picture-in-Picture settings. - **enabled** (boolean) - Whether PiP is enabled. - **cameras** (array) - Array of PiP camera configurations. - **id** (integer) - ID of the camera to display in PiP. - **x** (integer) - X-coordinate of the PiP window. - **y** (integer) - Y-coordinate of the PiP window. - **width** (integer) - Width of the PiP window. - **height** (integer) - Height of the PiP window. ### Request Example ```json { "settings": { "timestampformatter": "{FPS},{0:G},{CAMERA},{REC}", "timestampforecolor": "#FFFFFF", "timestampbackcolor": "#000000", "timestampshowback": true, "timestampfont": 14, "timestamplocation": 1, "maskimage": "mask1.png", "pip": { "enabled": true, "cameras": [ { "id": 1, "x": 10, "y": 10, "width": 160, "height": 120 } ] } } } ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### ONVIF Camera Discovery in C# Source: https://context7.com/ispysoftware/ispy/llms.txt Scans the network for ONVIF-compatible cameras and retrieves their connection details. This C# code snippet demonstrates how to use the CameraScanner class to find cameras and handle the URLFound event. ```csharp // Usage in C# using iSpyApplication.CameraDiscovery; var scanner = new CameraScanner(); scanner.URLFound += (sender, e) => { Console.WriteLine($"Found camera at {e.Co.URL}"); Console.WriteLine($"Make: {e.Co.Make}, Model: {e.Co.Model}"); }; scanner.Start(); ``` -------------------------------- ### PTZ Control Commands (C#) Source: https://context7.com/ispysoftware/ispy/llms.txt Provides a C# method for sending Pan-Tilt-Zoom commands to compatible cameras. Supports directional movements, zoom, stop, center, and preset operations. This function abstracts the underlying command execution. ```csharp // PTZController.cs usage public void SendPTZCommand(Enums.PtzCommand command, int panSpeed = 50, int tiltSpeed = 50) { // Commands: Up, Down, Left, Right, ZoomIn, ZoomOut, Stop, Center // Preset commands: GoPreset1-6, SetPreset1-6 switch (command) { case Enums.PtzCommand.Up: ExecuteCommand(PTZSettings.Commands.Up); break; case Enums.PtzCommand.Stop: ExecuteCommand(PTZSettings.Commands.Stop); break; } } ``` -------------------------------- ### POST /api/editaction.json - Configure Alert Actions Source: https://context7.com/ispysoftware/ispy/llms.txt Sets up automated actions triggered by alerts, including email notifications, FTP uploads, command execution, and cloud uploads. ```APIDOC ## Configure Alert Actions ### Description Set up automated actions triggered by alerts including email, FTP upload, execute commands, and cloud uploads. ### Method POST ### Endpoint `/api/editaction.json` ### Query Parameters - **ot** (integer) - Optional. Likely an object type identifier. - **oid** (integer) - Optional. Likely an object ID. - **token** (string) - Required. Authentication token. ### Request Body - **actions** (array) - An array of alert actions. - **type** (string) - The type of action (e.g., "Email", "ExecuteCommand"). - **mode** (string) - The mode of the action (e.g., "alert"). - **ident** (string) - Identifier for the action (e.g., email address, command path). - **subject** (string) - Optional. Subject for email alerts. - **body** (string) - Optional. Body for email alerts. Supports placeholders like {CAMERA}. - **commandline** (string) - Optional. The command to execute for "ExecuteCommand" type. ### Request Example ```bash curl -X POST "http://localhost:8080/api/editaction.json?ot=2&oid=0&token=YOUR_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "actions": [ { "type": "Email", "mode": "alert", "ident": "admin@example.com", "subject": "Motion Detected - {CAMERA}", "body": "Motion detected at {0:yyyy-MM-dd HH:mm:ss}" }, { "type": "ExecuteCommand", "mode": "alert", "commandline": "C:\\Scripts\\alert.bat" } ] }' ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### Configure Alert Actions via API (Bash) Source: https://context7.com/ispysoftware/ispy/llms.txt Sets up automated actions triggered by alerts, such as sending emails or executing commands. This bash script uses the /api/editaction.json endpoint to define alert-triggered events. ```bash curl -X POST "http://localhost:8080/api/editaction.json?ot=2&oid=0&token=YOUR_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "actions": [ { "type": "Email", "mode": "alert", "ident": "admin@example.com", "subject": "Motion Detected - {CAMERA}", "body": "Motion detected at {0:yyyy-MM-dd HH:mm:ss}" }, { "type": "ExecuteCommand", "mode": "alert", "commandline": "C:\\Scripts\\alert.bat" } ] }' ``` -------------------------------- ### FTP Upload Configuration Source: https://context7.com/ispysoftware/ispy/llms.txt Configures automated FTP uploads for snapshots and recordings, including connection details, filename formatting, and intervals. ```APIDOC ## FTP Upload Configuration ### Description Configure automated FTP uploads for snapshots and recordings with customizable filenames and intervals. ### Method Not specified (Likely PUT or POST to a configuration endpoint) ### Endpoint Not specified ### Request Body - **ftp** (object) - FTP settings. - **enabled** (boolean) - Whether FTP upload is enabled. - **mode** (integer) - FTP mode (specific meaning not detailed). - **ident** (string) - FTP server identifier or username. - **quality** (integer) - Image quality for uploads (0-100). - **filename** (string) - Filename format for uploaded files. Supports date/time placeholders. - **intervalnew** (float) - Interval in seconds for new uploads. - **minimumdelay** (float) - Minimum delay between uploads in seconds. - **recorder** (object) - Recorder specific FTP settings. - **ftpenabled** (boolean) - Whether FTP is enabled for recordings. - **ftpfilename** (string) - Filename format for uploaded recordings. Supports placeholders like {CAMERA}. ### Request Example ```json { "ftp": { "enabled": true, "mode": 0, "ident": "mainserver", "quality": 85, "filename": "{0:yyyy-MM-dd_HH-mm-ss_fff}.jpg", "intervalnew": 5.0, "minimumdelay": 2.0 }, "recorder": { "ftpenabled": true, "ftpfilename": "{CAMERA}_{0:yyyy-MM-dd_HH-mm-ss}.mp4" } } ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### Timestamp and Overlay Configuration in JSON Source: https://context7.com/ispysoftware/ispy/llms.txt Customizes video overlays, including timestamps with specified formats and colors, masks, and picture-in-picture from other cameras. This JSON configuration allows for detailed control over visual elements on the video feed. ```json { "settings": { "timestampformatter": "{FPS},{0:G},{CAMERA},{REC}", "timestampforecolor": "#FFFFFF", "timestampbackcolor": "#000000", "timestampshowback": true, "timestampfont": 14, "timestamplocation": 1, "maskimage": "mask1.png", "pip": { "enabled": true, "cameras": [ { "id": 1, "x": 10, "y": 10, "width": 160, "height": 120 } ] } } } ``` -------------------------------- ### ONVIF Camera Discovery Source: https://context7.com/ispysoftware/ispy/llms.txt Scans the local network for ONVIF-compatible cameras and retrieves their connection details and device information. ```APIDOC ## ONVIF Camera Discovery ### Description Scan network for ONVIF-compatible cameras and retrieve connection details. ### Method Not specified (Likely a client-side operation or a specific discovery endpoint) ### Endpoint Not specified ### Usage Example (C#) ```csharp // Usage in C# using iSpyApplication.CameraDiscovery; var scanner = new CameraScanner(); scanner.URLFound += (sender, e) => { Console.WriteLine($"Found camera at {e.Co.URL}"); Console.WriteLine($"Make: {e.Co.Make}, Model: {e.Co.Model}"); }; scanner.Start(); ``` ### Response (Event Data) - **e.Co.URL** (string) - The discovery URL for the ONVIF camera. - **e.Co.Make** (string) - The manufacturer of the camera. - **e.Co.Model** (string) - The model of the camera. ``` -------------------------------- ### Add Video Source (API) Source: https://context7.com/ispysoftware/ispy/llms.txt Adds a new video source to the iSpy system. Requires specifying the source type ID and relevant configuration parameters via a POST request to the /api/api.json endpoint with specific query parameters. ```bash curl -X POST "http://localhost:8080/api/api.json?cmd=adddevice&ot=2&sourceTypeID=2&token=YOUR_AUTH_TOKEN" \ -H "Content-Type: application/json" ``` -------------------------------- ### Helper Utility Functions Source: https://context7.com/ispysoftware/ispy/llms.txt Core utility functions for video processing, path management, and network operations. ```APIDOC ## Helper Utility Functions ### Description Provides access to core utility functions for various iSpy operations. ### Helper.CalcResizeSize #### Description Calculates resized dimensions while maintaining the aspect ratio. #### Parameters - **resize** (boolean) - Whether to perform resizing. - **nativeSize** (Size) - The original dimensions of the media. - **resizeSize** (Size) - The target dimensions for resizing. If one dimension is 0, it will be calculated automatically to maintain aspect ratio. #### Returns - **Size** - The calculated new dimensions. #### Example ```csharp var newSize = Helper.CalcResizeSize( resize: true, nativeSize: new Size(1920, 1080), resizeSize: new Size(640, 0) // Auto-calculate height ); // Returns: Size(640, 360) ``` ### Program.AppPath #### Description Gets the installation directory of the iSpy application. #### Returns - **string** - The application's installation path. #### Example ```csharp string appPath = Program.AppPath; ``` ### Program.AppDataPath #### Description Gets the user data directory for the iSpy application. #### Returns - **string** - The path to the user data directory (e.g., `%AppData%\iSpy\`). #### Example ```csharp string appDataPath = Program.AppDataPath; ``` ### Helper.GetSourceType #### Description Converts a source type string to its corresponding integer ID. #### Parameters - **sourceTypeString** (string) - The string representation of the source type (e.g., "FFMPEG"). - **sourceType** (int) - An integer indicating whether it's a video (0) or audio (1) source type. #### Returns - **int** - The integer ID for the source type. #### Example ```csharp int videoSourceType = Helper.GetSourceType("FFMPEG", 0); // Returns: 2 int audioSourceType = Helper.GetSourceType("FFMPEG", 1); // Returns: 3 ``` ``` -------------------------------- ### Configure Camera Settings (API) Source: https://context7.com/ispysoftware/ispy/llms.txt Allows modification of camera settings such as video source, motion detection parameters, recording schedules, alerts, PTZ control, and storage preferences. Uses a POST request to the /api/editcamera.json endpoint with a JSON payload. ```bash curl -X POST "http://localhost:8080/api/editcamera.json?oid=0&token=YOUR_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Front Door Camera", "settings": { "active": true, "sourceindex": 2, "videosourcestring": "rtsp://192.168.1.100:554/stream", "login": "admin", "password": "password123", "maxframerate": 15 }, "detector": { "type": "Two Frames", "recordondetect": true, "minsensitivity": 20, "maxsensitivity": 80, "gain": 10 }, "alerts": { "active": true, "mode": "movement", "minimuminterval": 30 }, "recorder": { "quality": 8, "maxrecordtime": 300, "bufferseconds": 5 } }' ``` -------------------------------- ### PTZ Control Commands (API) Source: https://context7.com/ispysoftware/ispy/llms.txt Allows remote control of PTZ (Pan-Tilt-Zoom) enabled cameras via the REST API. Supports directional commands, setting and recalling presets using POST requests to /api/api.json. ```bash # HTTP API for PTZ control curl -X POST "http://localhost:8080/api/api.json?cmd=ptzcommand&ot=2&oid=0&command=Up&token=YOUR_AUTH_TOKEN" # Set camera preset position curl -X POST "http://localhost:8080/api/api.json?cmd=ptzcommand&ot=2&oid=0&command=SetPreset1&token=YOUR_AUTH_TOKEN" # Go to preset position curl -X POST "http://localhost:8080/api/api.json?cmd=ptzcommand&ot=2&oid=0&command=GoPreset1&token=YOUR_AUTH_TOKEN" ``` -------------------------------- ### Configure Motion Detection Zones in JSON Source: https://context7.com/ispysoftware/ispy/llms.txt Defines specific areas within the camera view for motion detection, including sensitivity thresholds and processing intervals. This JSON configuration allows for granular control over where and how motion is detected. ```json { "detector": { "type": "Two Frames", "minsensitivity": 20, "maxsensitivity": 80, "gain": 10, "suppressnoise": true, "processframeinterval": 100, "zones": [ { "x": 100, "y": 100, "width": 200, "height": 150, "sensitivity": 50 } ] } } ``` -------------------------------- ### Configure FTP Uploads in JSON Source: https://context7.com/ispysoftware/ispy/llms.txt Configures automated FTP uploads for media files, including snapshots and recordings. This JSON object specifies FTP server details, quality settings, filename formats, and intervals for uploads. ```json { "ftp": { "enabled": true, "mode": 0, "ident": "mainserver", "quality": 85, "filename": "{0:yyyy-MM-dd_HH-mm-ss_fff}.jpg", "intervalnew": 5.0, "minimumdelay": 2.0 }, "recorder": { "ftpenabled": true, "ftpfilename": "{CAMERA}_{0:yyyy-MM-dd_HH-mm-ss}.mp4" } } ``` -------------------------------- ### Timelapse Recording Configuration in JSON Source: https://context7.com/ispysoftware/ispy/llms.txt Enables and configures timelapse video generation. This JSON object allows for specifying whether timelapse is enabled, the desired framerate, and parameters related to frame capture intervals and saving frequency. ```json { "recorder": { "timelapseenabled": true, "timelapseframerate": 30, "timelapse": 10, "timelapseframes": 5, "timelapsesave": 60 } } ``` -------------------------------- ### Storage Management Configuration in JSON Source: https://context7.com/ispysoftware/ispy/llms.txt Configures automatic storage cleanup rules for recorded media. This JSON object enables storage management, specifies the storage directory, and sets limits for maximum size and age, with an option for archiving. ```json { "settings": { "directoryIndex": 0, "directory": "frontdoor", "storagemanagement": { "enabled": true, "archive": true, "maxsize": 10240, "maxage": 168 } } } ``` -------------------------------- ### PTZ Control Commands Source: https://context7.com/ispysoftware/ispy/llms.txt Sends Pan-Tilt-Zoom (PTZ) commands to compatible cameras, including directional movements, zoom, speed adjustments, and preset management. ```APIDOC ## POST /api/api.json?cmd=ptzcommand ### Description Send PTZ (Pan-Tilt-Zoom) commands to supported cameras using direction, speed, and preset controls. ### Method POST ### Endpoint /api/api.json ### Query Parameters - **cmd** (string) - Required - Must be "ptzcommand". - **ot** (integer) - Required - Object type (must be 2 for camera). - **oid** (integer) - Required - The object ID of the camera to control. - **command** (string) - Required - The PTZ command to execute (e.g., "Up", "Down", "Left", "Right", "ZoomIn", "ZoomOut", "Stop", "Center", "SetPreset1"-"SetPreset6", "GoPreset1"-"GoPreset6"). - **token** (string) - Required - Authentication token for the API request. ### Request Example (Move Up) ```bash curl -X POST "http://localhost:8080/api/api.json?cmd=ptzcommand&ot=2&oid=0&command=Up&token=YOUR_AUTH_TOKEN" ``` ### Request Example (Set Preset 1) ```bash curl -X POST "http://localhost:8080/api/api.json?cmd=ptzcommand&ot=2&oid=0&command=SetPreset1&token=YOUR_AUTH_TOKEN" ``` ### Request Example (Go to Preset 1) ```bash curl -X POST "http://localhost:8080/api/api.json?cmd=ptzcommand&ot=2&oid=0&command=GoPreset1&token=YOUR_AUTH_TOKEN" ``` ### Response *Note: The PTZ command API typically returns a simple success confirmation or an error message, rather than detailed data.* ``` -------------------------------- ### Camera Discovery API Source: https://context7.com/ispysoftware/ispy/llms.txt Endpoints for discovering devices on the network and retrieving scan results. ```APIDOC ## GET /api/api.json?cmd=startdevicescan ### Description Starts a device scan on the network to discover cameras. ### Method GET ### Endpoint `/api/api.json?cmd=startdevicescan` ### Query Parameters - **token** (string) - Required - Your authentication token. ### Response Example ```json { "status": "success" } ``` ## GET /api/api.json?cmd=getdevicescan ### Description Retrieves the results of the last device scan. ### Method GET ### Endpoint `/api/api.json?cmd=getdevicescan` ### Query Parameters - **token** (string) - Required - Your authentication token. ### Response #### Success Response (200) - **devices** (array) - An array of discovered devices. - **url** (string) - The stream URL for the device. - **make** (string) - The manufacturer of the device. - **model** (string) - The model of the device. - **username** (string) - The username for accessing the device (if applicable). - **channels** (array) - An array of channel IDs for the device. #### Response Example ```json { "devices": [ { "url": "rtsp://192.168.1.100:554/stream", "make": "Hikvision", "model": "DS-2CD2042WD-I", "username": "", "channels": [0, 1] } ] } ``` ``` -------------------------------- ### Add Video Source API Source: https://context7.com/ispysoftware/ispy/llms.txt Adds a new video source (camera or microphone) to the iSpy system, specifying the source type and its configuration details. ```APIDOC ## POST /api/api.json?cmd=adddevice ### Description Add a new video source to the system by specifying the source type ID and configuration parameters. ### Method POST ### Endpoint /api/api.json ### Query Parameters - **cmd** (string) - Required - Must be "adddevice". - **ot** (integer) - Required - Object type (e.g., 2 for camera). - **sourceTypeID** (integer) - Required - The ID of the source type to add. - **token** (string) - Required - Authentication token for the API request. ### Response #### Success Response (200) - **actionResult** (string) - Indicates the result of the action (e.g., "editsource"). - **typeID** (integer) - The type ID of the added source. - **ID** (integer) - The object ID assigned to the newly added source. #### Response Example ```json { "actionResult": "editsource", "typeID": 2, "ID": 5 } ``` ``` -------------------------------- ### Timelapse Recording Configuration Source: https://context7.com/ispysoftware/ispy/llms.txt Enables and configures timelapse video generation from captured frames, specifying frame rates and intervals. ```APIDOC ## Timelapse Recording ### Description Generate timelapse videos from continuous or interval-based frame capture. ### Method Not specified (Likely PUT or POST to a configuration endpoint) ### Endpoint Not specified ### Request Body - **recorder** (object) - **timelapseenabled** (boolean) - Whether timelapse recording is enabled. - **timelapseframerate** (integer) - Frame rate for the timelapse video. - **timelapse** (integer) - Interval in seconds between captured frames for timelapse. - **timelapseframes** (integer) - Number of frames to capture for each timelapse segment. - **timelapsesave** (integer) - Interval in seconds to save the timelapse video. ### Request Example ```json { "recorder": { "timelapseenabled": true, "timelapseframerate": 30, "timelapse": 10, "timelapseframes": 5, "timelapsesave": 60 } } ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### C# Helper: Convert Source Type Strings to IDs Source: https://context7.com/ispysoftware/ispy/llms.txt Converts human-readable source type strings (like 'FFMPEG') into their corresponding integer IDs. This is used internally by the application for various source types, including video and audio. ```csharp // Convert source type strings to IDs int videoSourceType = Helper.GetSourceType("FFMPEG", 0); // Returns: 2 int audioSourceType = Helper.GetSourceType("FFMPEG", 1); // Returns: 3 ``` -------------------------------- ### Cloud Provider Integration Source: https://context7.com/ispysoftware/ispy/llms.txt Integrates with cloud storage services like Dropbox, allowing uploads of recordings and images with specified paths and authentication. ```APIDOC ## Cloud Provider Integration ### Description Upload media to cloud storage services with OAuth authentication and path configuration. ### Method POST ### Endpoint `/api/settings.json` (for authorization) `/api/editcamera.json` (for configuration) ### Query Parameters - **action** (string) - For `/api/settings.json`, use "authorise". - **parameter** (string) - For `/api/settings.json`, specify the cloud provider (e.g., "dropbox"). - **token** (string) - Required. Authentication token. - **oid** (integer) - For `/api/editcamera.json`, the object ID of the camera. ### Request Body (for `/api/editcamera.json`) - **settings** (object) - **cloudprovider** (object) - **provider** (string) - Name of the cloud provider (e.g., "Dropbox"). - **path** (string) - Path within the cloud storage (e.g., "/Security/FrontDoor"). - **recordings** (boolean) - Whether to upload recordings. - **images** (boolean) - Whether to upload images. ### Request Example (Authorize Dropbox) ```bash curl -X POST "http://localhost:8080/api/settings.json?action=authorise¶meter=dropbox&token=YOUR_AUTH_TOKEN" ``` ### Request Example (Configure Cloud Upload) ```bash curl -X POST "http://localhost:8080/api/editcamera.json?oid=0&token=YOUR_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "settings": { "cloudprovider": { "provider": "Dropbox", "path": "/Security/FrontDoor", "recordings": true, "images": true } } }' ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### Storage Management API Source: https://context7.com/ispysoftware/ispy/llms.txt Configures automatic storage cleanup based on size and age limits, with an option for archiving old data. ```APIDOC ## Storage Management API ### Description Configure automatic storage cleanup with size and age limits, plus optional archiving. ### Method Not specified (Likely PUT or POST to a configuration endpoint) ### Endpoint Not specified ### Request Body - **settings** (object) - **directoryIndex** (integer) - Index of the storage directory. - **directory** (string) - Name of the storage directory (e.g., "frontdoor"). - **storagemanagement** (object) - Storage management configuration. - **enabled** (boolean) - Whether storage management is enabled. - **archive** (boolean) - Whether to archive old data. - **maxsize** (integer) - Maximum storage size in MB (e.g., 10240 for 10GB). - **maxage** (integer) - Maximum age of files in hours (e.g., 168 for 7 days). ### Request Example ```json { "settings": { "directoryIndex": 0, "directory": "frontdoor", "storagemanagement": { "enabled": true, "archive": true, "maxsize": 10240, "maxage": 168 } } } ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### Query Motion/Audio Level API Source: https://context7.com/ispysoftware/ispy/llms.txt Retrieves the current motion detection level for cameras or audio level for microphones. ```APIDOC ## GET /api/api.json?cmd=querylevel ### Description Get real-time motion level for cameras (typeID=2) or audio level for microphones (typeID=1). ### Method GET ### Endpoint /api/api.json ### Query Parameters - **cmd** (string) - Required - Must be "querylevel". - **ot** (integer) - Required - Object type (e.g., 2 for camera, 1 for microphone). - **oid** (integer) - Required - The object ID of the camera or microphone. - **token** (string) - Required - Authentication token for the API request. ### Response #### Success Response (200) - **level** (number) - The detected level (0.0 to 1.0). #### Response Example ```json { "level": 0.42 } ``` ``` -------------------------------- ### Edit Camera API Source: https://context7.com/ispysoftware/ispy/llms.txt Configures settings for a specific camera, including its video source, motion detection parameters, recording schedule, alert triggers, and PTZ controls. ```APIDOC ## POST /api/editcamera.json ### Description Configure camera settings including video source, motion detection, recording parameters, alerts, PTZ control, uploads, and storage management. ### Method POST ### Endpoint /api/editcamera.json ### Query Parameters - **oid** (integer) - Required - The object ID of the camera to edit. - **token** (string) - Required - Authentication token for the API request. ### Request Body - **name** (string) - Required - The name of the camera. - **settings** (object) - Camera specific settings. - **active** (boolean) - Whether the camera is active. - **sourceindex** (integer) - The index of the video source. - **videosourcestring** (string) - The connection string for the video source (e.g., RTSP URL). - **login** (string) - Optional - Username for camera authentication. - **password** (string) - Optional - Password for camera authentication. - **maxframerate** (integer) - The maximum frame rate for the camera stream. - **detector** (object) - Motion detection settings. - **type** (string) - The type of motion detection algorithm. - **recordondetect** (boolean) - Whether to record when motion is detected. - **minsensitivity** (integer) - Minimum sensitivity threshold for detection. - **maxsensitivity** (integer) - Maximum sensitivity threshold for detection. - **gain** (integer) - Gain adjustment for detection. - **alerts** (object) - Alerting configuration. - **active** (boolean) - Whether alerts are enabled. - **mode** (string) - The mode for triggering alerts (e.g., "movement"). - **minimuminterval** (integer) - Minimum interval between alerts in seconds. - **recorder** (object) - Recording settings. - **quality** (integer) - Recording quality (e.g., JPEG quality). - **maxrecordtime** (integer) - Maximum recording duration in seconds. - **bufferseconds** (integer) - Number of seconds to buffer before recording starts. ### Request Example ```json { "name": "Front Door Camera", "settings": { "active": true, "sourceindex": 2, "videosourcestring": "rtsp://192.168.1.100:554/stream", "login": "admin", "password": "password123", "maxframerate": 15 }, "detector": { "type": "Two Frames", "recordondetect": true, "minsensitivity": 20, "maxsensitivity": 80, "gain": 10 }, "alerts": { "active": true, "mode": "movement", "minimuminterval": 30 }, "recorder": { "quality": 8, "maxrecordtime": 300, "bufferseconds": 5 } } ``` ### Response #### Success Response (200) - **status** (string) - The status of the operation (e.g., "ok"). - **actionResult** (string) - The result of the action (e.g., "cameraupdated"). - **ID** (integer) - The object ID of the updated camera. #### Response Example ```json { "status": "ok", "actionResult": "cameraupdated", "ID": 0 } ``` ``` -------------------------------- ### Configure Motion Detection Zones Source: https://context7.com/ispysoftware/ispy/llms.txt Defines specific areas within the camera view for motion detection, including sensitivity thresholds and processing intervals. ```APIDOC ## Configure Motion Detection Zones ### Description Defines specific areas within the camera view to monitor for motion with sensitivity thresholds. ### Method Not specified (Likely PUT or POST to a configuration endpoint) ### Endpoint Not specified ### Request Body - **detector** (object) - Configuration for the motion detector. - **type** (string) - The type of motion detection algorithm (e.g., "Two Frames"). - **minsensitivity** (integer) - Minimum sensitivity threshold for motion detection. - **maxsensitivity** (integer) - Maximum sensitivity threshold for motion detection. - **gain** (integer) - Gain setting for the detector. - **suppressnoise** (boolean) - Whether to suppress noise. - **processframeinterval** (integer) - Interval in milliseconds between frame processing. - **zones** (array) - An array of motion detection zones. - **x** (integer) - X-coordinate of the zone's top-left corner. - **y** (integer) - Y-coordinate of the zone's top-left corner. - **width** (integer) - Width of the zone. - **height** (integer) - Height of the zone. - **sensitivity** (integer) - Sensitivity specific to this zone. ### Request Example ```json { "detector": { "type": "Two Frames", "minsensitivity": 20, "maxsensitivity": 80, "gain": 10, "suppressnoise": true, "processframeinterval": 100, "zones": [ { "x": 100, "y": 100, "width": 200, "height": 150, "sensitivity": 50 } ] } } ``` ### Response (Response details not provided in the source text) ``` -------------------------------- ### C# Helper: Calculate Resized Dimensions Source: https://context7.com/ispysoftware/ispy/llms.txt Calculates new dimensions for resizing an image while maintaining its aspect ratio. It takes the native size and a target resize size (where one dimension can be 0 to auto-calculate). ```csharp using iSpyApplication; // Calculate resized dimensions maintaining aspect ratio var newSize = Helper.CalcResizeSize( resize: true, nativeSize: new Size(1920, 1080), resizeSize: new Size(640, 0) // Auto-calculate height ); // Returns: Size(640, 360) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.