commands

package
v0.0.0-...-3deab84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAdminPassword = "666666"

Variables

View Source
var CameraTypeChannel = map[uint8]CameraType{
	0: CameraTypeFront,
	1: CameraTypeInward,
	2: CameraTypeBoth,
}

Functions

func CapturePicture

func CapturePicture(camera CameraType) string

CapturePicture Capture the images from the device. Example: Picture,in

func CaptureVideo

func CaptureVideo(camera CameraType, seconds uint8) string

CaptureVideo Capture the video from the device. duration should be between 3s and 10s. Example: Video,in,3s

func ChangePassword

func ChangePassword(oldPassword, newPassword string) string

ChangePassword changes the password of device Example: PASSWORD,666666,123456

func CoreKitSwitch

func CoreKitSwitch(mode CoreKitMode) string
CoreKitSwitch switches platform mode

Note: Before switching the device to the integrated version, you must first do the followings in the strict order: switch the working logic, modify the addresses of HTTP and RTMP servers, and modify the address of the TCP server.

func GenerateCommand

func GenerateCommand(command DeviceCommand, params ...string) string

GenerateCommand generates a command with optional parameters

func Mirror

func Mirror(state OnOffState) string

Mirror Control the mirroring of the backup camera (rear-view) Example: MIRROR,in,OFF

func ModifyHttpUploadServer

func ModifyHttpUploadServer(url string) string

ModifyHttpUploadServer modifies http upload server url Example: UPLOAD,http://www.baidu.com/upload

func RecordAudio

func RecordAudio(state EnableDisable) string

RecordAudio Whether to record audio along with the video. Example: RECORDAUDIO,0

func RecordAudioSub

func RecordAudioSub(state EnableDisable) string

RecordAudioSub Whether to record audio along with the video (playback video & live streaming) Example: RECORDAUDIO_SUB,0

func RecordSwitch

func RecordSwitch(camera RecordSwitchCamera, state EnableDisable) string

RecordSwitch Set the independent switch for a camera Example: RECORDSW,1,1

func ReplayVideoList

func ReplayVideoList(videoNames []string) string

ReplayVideoList Request playback video streaming Example: REPLAYLIST,2021_05_31_08_10_45_02.mp4,2021_05_31_08_11_46_02.mp4,2021_05_31_08_12_48_02.mp4

func Rotation

func Rotation(camera CameraInOut, rotation RotationDegree) string

Rotation Set the rotation angle of the camera image. Example: RATATION,IN,90

func RtmpLiveStream

func RtmpLiveStream(OnOff OnOffState, camera CameraType, pushDuration uint8) string

RtmpLiveStream enables,disables live video stream duration should be between 2 and 180 minute default is 15. Example: RTMP,ON,OUT

func RtmpLogin

func RtmpLogin(userName, password string) string

RtmpLogin sets login information for rtmp live video streaming Example: RLOGIN,jimi,88888888

func SetDeviceVolume

func SetDeviceVolume(level VolumeLevel) string

SetDeviceVolume defines the volume level of the device.

func SetFileListServer

func SetFileListServer(url string) string

SetFileListServer modifies the url address to receive the history videos name list

Example: FILELIST,http://www.baidu.com

func SetHttpUploadLimit

func SetHttpUploadLimit(retryCount, retryInterval uint8) string
SetHttpUploadLimit changes http upload limit for when platform doesn't respond after the device uploads data over HTTP

retryCount[1-10] default: 5 retryInterval[1-30] default: 3minute

Example: HTTPUPLOADLIMIT,5,3

func SetInwardVideoQuality

func SetInwardVideoQuality(quality VideoQualityInward) string

func SetLEDOnOff

func SetLEDOnOff(state OnOffState) string

SetLEDOnOff defines whether to light on LEDs (all-day)

func SetOutVideoQuality

func SetOutVideoQuality(quality VideoQualityOut) string

func SetRtmpServer

func SetRtmpServer(url string) string

SetRtmpServer modifies the address of the RTMP server Example: RSERVICE,192.168.0.1:1935/live

func SetSpeedUnit

func SetSpeedUnit(speedUnit VideoResolution) string

SetSpeedUnit Set the unit of speed on the overlay of video

func SetTCPServer

func SetTCPServer(host HostType, serverAddr string, port uint16) string

SetTCPServer modifies the address of the tcp server. The device will restart after the address of the TCP server is changed. Example: SERVER,1,dvrdev.tracksolidpro.com,21100

func UploadEventFile

func UploadEventFile(fileName string) string

UploadEventFile Upload videos of a specific event type (a command to upload video files on demand) Example: UPLOADFILE,EVENT_357730090564767_00000000_2021_01_29_07_28_18_F_05.mp4

func UploadEventVideo

func UploadEventVideo(timeStamp string, cameraType HistoryCameraType, lengthSecond uint8) string

UploadEventVideo Generate and upload event videos which store in SD card.

timestamp Format=Year-Month-Day Hour:Minute:Second. length between 10-60 second default is 15.

Example: EVIDEO,2020-06-15 12:12:12,1,30

func UploadHistoryVideo

func UploadHistoryVideo(timeStamp string, cameraType HistoryCameraType) string

UploadHistoryVideo Upload the playback video which store in memory (each one minute) timestamp format: (Year_Month_Day_Hour_Minute_Second) Example: HVIDEO,2020_01_01_24_05_06,1

func UploadPlaybackVideosList

func UploadPlaybackVideosList() string

UploadPlaybackVideosList requests to upload the playback video name list

func VideoResolutionSub

func VideoResolutionSub(resolution VideoResolution) string

VideoResolutionSub Set the quality for livestreaming or playback video

Types

type CameraInOut

type CameraInOut string
const (
	CameraIn  CameraInOut = "IN"
	CameraOut CameraInOut = "OUT"
)

type CameraType

type CameraType string
const (
	CameraTypeInward CameraType = "IN"
	CameraTypeFront  CameraType = "OUT"
	CameraTypeBoth   CameraType = "INOUT"
)

type CoreKitMode

type CoreKitMode int
const (
	CoreKitIntegrated  CoreKitMode = 0
	CoreKitDistributed CoreKitMode = 1
)

type DeviceCommand

type DeviceCommand string

DeviceCommand represents a command type

const (
	APN       DeviceCommand = "APN"
	ROAMING   DeviceCommand = "ROAMING"
	WIFIAP    DeviceCommand = "WIFIAP"
	SSID      DeviceCommand = "SSID"
	BTNAME    DeviceCommand = "BTNAME"
	VOLUME    DeviceCommand = "VOLUME"
	VOICESW   DeviceCommand = "VOICESW"
	LED       DeviceCommand = "LED"
	TIMESYNC  DeviceCommand = "TIMESYNC"
	TIMEZONE  DeviceCommand = "TIMEZONE"
	NETWORK   DeviceCommand = "NETWORK"
	GTRANS    DeviceCommand = "GTRANS"
	GCALIBRAT DeviceCommand = "GCALIBRAT"
	RANGE     DeviceCommand = "RANGE"
	PASSWORD  DeviceCommand = "PASSWORD"
	VERSION   DeviceCommand = "VERSION"
	RESTORE   DeviceCommand = "RESTORE"
	REBOOT    DeviceCommand = "REBOOT"
	LOGALL    DeviceCommand = "LOG,ALL"
	LOG       DeviceCommand = "LOG"
	STATUS    DeviceCommand = "STATUS"
	PARAM     DeviceCommand = "PARAM"
	PING      DeviceCommand = "PING"
	FORMAT    DeviceCommand = "FORMAT"
)

device management commands

const (
	RECORDAUDIO         DeviceCommand = "RECORDAUDIO"
	RECORDAUDIO_SUB     DeviceCommand = "RECORDAUDIO_SUB"
	RECORDSW            DeviceCommand = "RECORDSW"
	MIRROR              DeviceCommand = "MIRROR"
	RATATION            DeviceCommand = "RATATION"
	CAMERA              DeviceCommand = "CAMERA"
	VIDEORESOLUTION_SUB DeviceCommand = "VIDEORESOLUTION_SUB"
	MILE                DeviceCommand = "MILE"
	CAR                 DeviceCommand = "CAR"
)

video recording commands

const (
	ACCREP           DeviceCommand = "ACCREP"
	TIMER            DeviceCommand = "TIMER"
	ANGLEREP         DeviceCommand = "ANGLEREP"
	EVENTGPS         DeviceCommand = "EVENTGPS"
	BUFFERCACHEQUERY DeviceCommand = "BUFFERCACHEQUERY"
)

tracking commands

const (
	FILTER         DeviceCommand = "FILTER"
	UPLOADSW       DeviceCommand = "UPLOADSW"
	ALARMTONE      DeviceCommand = "ALARMTONE"
	VIDEOPARAM     DeviceCommand = "VIDEOPARAM"
	EXBATALM       DeviceCommand = "EXBATALM"
	FATIGUE        DeviceCommand = "FATIGUE"
	SPEED          DeviceCommand = "SPEED"
	MILEAGE        DeviceCommand = "MILEAGE"
	SOSALM         DeviceCommand = "SOSALM"
	SOS            DeviceCommand = "SOS"
	CALL           DeviceCommand = "CALL"
	SENALM         DeviceCommand = "SENALM"
	DEFENSE        DeviceCommand = "DEFENSE"
	DEFENSE_TIME   DeviceCommand = "DEFENSE_TIME"
	SHOCK          DeviceCommand = "SHOCK"
	SHAKEDELAY     DeviceCommand = "SHAKEDELAY"
	NOSDCARDALM    DeviceCommand = "NOSDCARDALM"
	CRASHALM       DeviceCommand = "CRASHALM"
	SENSOR         DeviceCommand = "SENSOR"
	RAPIDACC       DeviceCommand = "RAPIDACC"
	RAPIDDEC       DeviceCommand = "RAPIDDEC"
	RAPIDTURN      DeviceCommand = "RAPIDTURN"
	RAPIDTEST      DeviceCommand = "RAPIDTEST"
	RAPIDSW        DeviceCommand = "RAPIDSW"
	PICTIMER       DeviceCommand = "PICTIMER"
	PICTIMERSIZE   DeviceCommand = "PICTIMERSIZE"
	PICRATE        DeviceCommand = "PICRATE"
	TIMERPICRAM    DeviceCommand = "TIMERPICRAM"
	TIMERPICRAMDEL DeviceCommand = "TIMERPICRAM,DEL"
)

event commands

const (
	RELAY               DeviceCommand = "RELAY"
	SPEEDOMETER         DeviceCommand = "SPEEDOMETER"
	CARDREADER          DeviceCommand = "CARDREADER"
	DRIVERLEVEL         DeviceCommand = "DRIVERLEVEL"
	EXDEVICESW          DeviceCommand = "EXDEVICESW"
	OILPARAM            DeviceCommand = "OILPARAM"
	OILIDSET            DeviceCommand = "OILIDSET"
	TEMPCOLLECTINTERVAL DeviceCommand = "TEMPCOLLECTINTERVAL"
	UART                DeviceCommand = "UART"
	TCALIBRAT           DeviceCommand = "TCALIBRAT"
)

Accessories commands

const (
	DMSSW              DeviceCommand = "DMSSW"
	DMS_SWITCH         DeviceCommand = "DMS_SWITCH"
	DMS_VOICE_CUSTOM   DeviceCommand = "DMS_VOICE_CUSTOM"
	DMS_ALERT_CUSTOM   DeviceCommand = "DMS_ALERT_CUSTOM"
	DMSCALIBRAT        DeviceCommand = "DMSCALIBRAT"
	DMS_VIRTUAL_SPEED  DeviceCommand = "DMS_VIRTUAL_SPEED"
	DMS_CONTINUITY     DeviceCommand = "DMS_CONTINUITY"
	DMS_CALIB_ABNORMAL DeviceCommand = "DMS_CALIB_ABNORMAL"
	DMS_SECOND_EVENT   DeviceCommand = "DMS_SECOND_EVENT"
)

DMS commands

const (
	COREKITSW       DeviceCommand = "COREKITSW"
	UPLOAD          DeviceCommand = "UPLOAD"
	HTTPUPLOADLIMIT DeviceCommand = "HTTPUPLOADLIMIT"
	RSERVICE        DeviceCommand = "RSERVICE"
	FILELIST        DeviceCommand = "FILELIST"
	SERVER          DeviceCommand = "SERVER"
	Picture         DeviceCommand = "Picture"
	Video           DeviceCommand = "Video"
	RTMP            DeviceCommand = "RTMP"
	REPLAYLIST      DeviceCommand = "REPLAYLIST"
	RLOGIN          DeviceCommand = "RLOGIN"
	HVIDEO          DeviceCommand = "HVIDEO"
	EVIDEO          DeviceCommand = "EVIDEO"
	UPLOADFILE      DeviceCommand = "UPLOADFILE"
	WIFIKIT         DeviceCommand = "WIFIKIT"
)

communication commands

type DeviceCommands

type DeviceCommands interface {
	GenerateCommand(command DeviceCommand, params ...string) string
	ParseParam(param string) *DeviceParams

	CoreKitSwitch(mode CoreKitMode) string
	ModifyHttpUploadServer(url string) string
	SetHttpUploadLimit(retryCount, retryInterval uint8) string
	SetRtmpServer(url string) string
	SetFileListServer(url string) string
	SetTCPServer(host HostType, serverAddr string, port uint16) string
	CapturePicture(camera CameraType) string
	CaptureVideo(camera CameraType, seconds uint8) string
	RtmpLiveStream(OnOff OnOffState, camera CameraType, pushDuration uint8) string
	UploadPlaybackVideosList() string
	ReplayVideoList(videoNames []string) string
	RtmpLogin(userName, password string) string
	UploadHistoryVideo(timeStamp string, cameraType HistoryCameraType) string
	UploadEventVideo(timeStamp string, cameraType HistoryCameraType, lengthSecond uint8) string
	UploadEventFile(fileName string) string

	RecordAudio(state EnableDisable) string
	RecordAudioSub(state EnableDisable) string
	RecordSwitch(camera RecordSwitchCamera, state EnableDisable) string
	Mirror(state OnOffState) string
	Rotation(camera CameraInOut, rotation RotationDegree) string
	SetInwardVideoQuality(quality VideoQualityInward) string
	SetOutVideoQuality(quality VideoQualityOut) string
	VideoResolutionSub(resolution VideoResolution) string
	SetSpeedUnit(speedUnit VideoResolution) string

	ChangePassword(oldPassword, newPassword string) string
	SetDeviceVolume(level VolumeLevel) string
	SetLEDOnOff(state OnOffState) string
}

type DeviceParams

type DeviceParams struct {
	IMEI     string
	TimeZone string
	GPSTime  string
}

func ParseParam

func ParseParam(param string) *DeviceParams

type EnableDisable

type EnableDisable uint8
const (
	Enable  EnableDisable = 1
	Disable EnableDisable = 0
)

type HistoryCameraType

type HistoryCameraType int
const (
	HistoryCameraTypeInward HistoryCameraType = 2
	HistoryCameraTypeFront  HistoryCameraType = 1
)

type HostType

type HostType int
const (
	HostTypeIPAddress HostType = 0
	HostTypeDomain    HostType = 1
)

type OnOffState

type OnOffState string
const (
	OffState OnOffState = "OFF"
	OnState  OnOffState = "ON"
)

type RecordSwitchCamera

type RecordSwitchCamera uint8
const (
	MainCamera RecordSwitchCamera = 1
	SubCamera  RecordSwitchCamera = 2
)

type RotationDegree

type RotationDegree int
const (
	NoRotation        RotationDegree = 0
	Rotation90Degree  RotationDegree = 90
	Rotation180Degree RotationDegree = 180
	Rotation270Degree RotationDegree = 270
)

type SpeedUnit

type SpeedUnit uint8
const (
	SpeedUnitKmh SpeedUnit = 0
	SpeedUnitMph SpeedUnit = 1
)

type VideoQualityInward

type VideoQualityInward uint8
const (
	VideoQuality720P6M VideoQualityInward = 0
	VideoQuality720P3M VideoQualityInward = 1
	VideoQuality4802M  VideoQualityInward = 2
	VideoQuality320    VideoQualityInward = 3
)

type VideoQualityOut

type VideoQualityOut uint8
const (
	VideoQualityOut1080P VideoQualityOut = 0
	VideoQualityOut720P  VideoQualityOut = 1
	VideoQualityOut480P  VideoQualityOut = 2
	VideoQualityOut320P  VideoQualityOut = 3
)

type VideoResolution

type VideoResolution uint8
const (
	VideoResolution360 VideoResolution = 0
	VideoResolution480 VideoResolution = 1
	VideoResolution720 VideoResolution = 2
)

type VolumeLevel

type VolumeLevel uint8
const (
	VolumeMute VolumeLevel = 0
	VolumeLow  VolumeLevel = 1
	VolumeMid  VolumeLevel = 2
	VolumeHigh VolumeLevel = 3
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL