001/*----------------------------------------------------------------------------*/ 002/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */ 003/* Open Source Software - may be modified and shared by FRC teams. The code */ 004/* must be accompanied by the FIRST BSD license file in the root directory of */ 005/* the project. */ 006/*----------------------------------------------------------------------------*/ 007 008package edu.wpi.cscore; 009 010/** 011 * A source that represents an Axis IP camera. 012 */ 013public class AxisCamera extends HttpCamera { 014 private static String hostToUrl(String host) { 015 return "http://" + host + "/mjpg/video.mjpg"; 016 } 017 018 private static String[] hostToUrl(String[] hosts) { 019 String[] urls = new String[hosts.length]; 020 for (int i = 0; i < hosts.length; i++) { 021 urls[i] = hostToUrl(hosts[i]); 022 } 023 return urls; 024 } 025 026 /** 027 * Create a source for an Axis IP camera. 028 * @param name Source name (arbitrary unique identifier) 029 * @param host Camera host IP or DNS name (e.g. "10.x.y.11") 030 */ 031 public AxisCamera(String name, String host) { 032 super(name, hostToUrl(host), HttpCameraKind.kAxis); 033 } 034 035 /** 036 * Create a source for an Axis IP camera. 037 * @param name Source name (arbitrary unique identifier) 038 * @param hosts Array of Camera host IPs/DNS names 039 */ 040 public AxisCamera(String name, String[] hosts) { 041 super(name, hostToUrl(hosts), HttpCameraKind.kAxis); 042 } 043}