Documentation ¶
Index ¶
- Constants
- Variables
- func CountEmails(ctx context.Context) (int64, error)
- func CountEvents(ctx context.Context) (int64, error)
- func CountFiles(ctx context.Context) (int64, error)
- func CreateDevice(ctx context.Context, arg CreateDeviceParams) (int64, error)
- func CreateEmail(ctx context.Context, arg CreateEmailParams) (int64, error)
- func CreateEventRule(ctx context.Context, arg repo.DahuaCreateEventRuleParams) (int64, error)
- func CreateStorageDestination(ctx context.Context, arg StorageDestination) (int64, error)
- func DeleteDevice(ctx context.Context, id int64) error
- func DeleteEventRule(ctx context.Context, id int64) error
- func DeleteEvents(ctx context.Context) error
- func DeleteStorageDestination(ctx context.Context, id int64) error
- func DeleteStream(ctx context.Context, stream repo.DahuaStream) error
- func FeatureFromStrings(featureStrings []string) models.DahuaFeature
- func FeatureToStrings(feature models.DahuaFeature) []string
- func FileFTPReadCloser(ctx context.Context, filePath string) (io.ReadCloser, error)
- func FileLocalDownload(ctx context.Context, client Client, fileID int64, ...) error
- func FileLocalReadCloser(ctx context.Context, client Client, filePath string) (io.ReadCloser, error)
- func FileSFTPReadCloser(ctx context.Context, filePath string) (io.ReadCloser, error)
- func GetCoaxialCaps(ctx context.Context, rpcClient dahuarpc.Conn, channel int) (models.DahuaCoaxialCaps, error)
- func GetCoaxialStatus(ctx context.Context, rpcClient dahuarpc.Conn, channel int) (models.DahuaCoaxialStatus, error)
- func GetDahuaDetail(ctx context.Context, rpcClient dahuarpc.Conn) (models.DahuaDetail, error)
- func GetDevice(ctx context.Context, id int64) (repo.DahuaDevice, error)
- func GetError(ctx context.Context, conn dahuarpc.Client) models.DahuaError
- func GetLicenseList(ctx context.Context, rpcClient dahuarpc.Conn) ([]models.DahuaLicense, error)
- func GetLiveRTSPURL(arg GetLiveRTSPURLParams) string
- func GetRPCStatus(ctx context.Context, rpcClient dahuarpc.Client) models.DahuaRPCStatus
- func GetSoftwareVersion(ctx context.Context, rpcClient dahuarpc.Conn) (models.DahuaSoftwareVersion, error)
- func GetStorage(ctx context.Context, rpcClient dahuarpc.Conn) ([]models.DahuaStorage, error)
- func GetSunriseSunset(ctx context.Context, c dahuarpc.Conn) (models.DahuaSunriseSunset, error)
- func GetUptime(ctx context.Context, c dahuarpc.Conn) (models.DahuaUptime, error)
- func GetUsers(ctx context.Context, rpcClient dahuarpc.Conn, location *time.Location) ([]models.DahuaUser, error)
- func Init(_app App)
- func Level(ctx context.Context, deviceID int64, level models.DahuaPermissionLevel) (bool, error)
- func ListDeviceIDs(ctx context.Context) ([]int64, error)
- func ListDevices(ctx context.Context) ([]repo.DahuaDevice, error)
- func ListEmailAlarmEvents(ctx context.Context) ([]string, error)
- func ListEventActions(ctx context.Context) ([]string, error)
- func ListEventCodes(ctx context.Context) ([]string, error)
- func ListEventRules(ctx context.Context) ([]repo.DahuaEventRule, error)
- func ListLatestFiles(ctx context.Context, count int) ([]repo.DahuaFile, error)
- func ListPresets(ctx context.Context, clientPTZ ptz.Client, channel int) ([]models.DahuaPreset, error)
- func ListStreams(ctx context.Context, deviceID int64) ([]repo.DahuaStream, error)
- func LoginSMTP(ctx context.Context, arg LoginSMTPParams) (repo.DahuaDevice, error)
- func NewDahuaEvent(v repo.DahuaEvent) models.DahuaEvent
- func NewDahuaFile(file mediafilefind.FindNextFileInfo, affixSeed int, location *time.Location) (models.DahuaFile, error)
- func NewDahuaFiles(files []mediafilefind.FindNextFileInfo, affixSeed int, location *time.Location) ([]models.DahuaFile, error)
- func Normalize(ctx context.Context) error
- func ParseStorage(storage string) (models.Storage, error)
- func PubSubMiddleware(ctx context.Context) pubsub.MiddlewareFunc
- func PushStreams(ctx context.Context, deviceID int64) error
- func Scan(ctx context.Context, rpcClient dahuarpc.Conn, device Conn, ...) error
- func ScanReset(ctx context.Context, deviceID int64) error
- func ScannerScan(ctx context.Context, rpcClient dahuarpc.Conn, scanPeriod ScannerPeriod, ...) (context.CancelFunc, <-chan error)
- func SetPreset(ctx context.Context, clientPTZ ptz.Client, channel, index int) error
- func StorageFromFilePath(filePath string) models.Storage
- func SupportStream(feature models.DahuaFeature) bool
- func SyncStreams(ctx context.Context, deviceID int64, conn dahuarpc.Conn) error
- func SyncSunriseSunset(ctx context.Context, c dahuarpc.Conn, loc *time.Location, ...) (models.DahuaSunriseSunset, error)
- func TestStorageDestination(ctx context.Context, arg StorageDestination) error
- func UpdateDevice(ctx context.Context, arg UpdateDeviceParams) error
- func UpdateDeviceDisabled(ctx context.Context, id int64, disable bool) error
- func UpdateEventRule(ctx context.Context, arg repo.DahuaUpdateEventRuleParams) error
- func UpdateStorageDestination(ctx context.Context, arg StorageDestination) error
- func UpdateStream(ctx context.Context, stream repo.DahuaStream, arg repo.DahuaUpdateStreamParams) (repo.DahuaStream, error)
- type App
- type Client
- type CoaxialWorker
- type Conn
- type CountFilesByMonthResult
- type CreateDeviceParams
- type CreateEmailParams
- type CreateEmailParamsAttachment
- type DefaultWorkerHooks
- type Email
- type EmailContent
- type EmailFilter
- type EventFilter
- type EventWorker
- type Feature
- type FileFilter
- type GetEmailAroundParams
- type GetEmailAroundResult
- type GetEmailParams
- type GetEmailResult
- type GetEmailResultAttachments
- type GetLiveRTSPURLParams
- type ListEmailsParams
- type ListEmailsResult
- type ListEmailsResultItems
- type ListEventsParams
- type ListEventsResult
- type ListEventsResultItems
- type ListFilesParams
- type ListFilesResult
- type ListFilesResultItems
- type ListLatestEmailsResult
- type LoginSMTPParams
- type QuickScanWorker
- type ScanLocker
- type ScannerPeriod
- type ScannerPeriodIterator
- type StorageDestination
- type Store
- type Thumbnail
- type ThumbnailForeignKeys
- type UpdateDeviceParams
- type Worker
- type WorkerFactory
- type WorkerHooks
- type WorkerManager
Constants ¶
View Source
const ( // MaxScannerPeriod is longest allowed time range for a mediafilefind query because some devices give invalid data past the MaxScannerPeriod. MaxScannerPeriod = 30 * 24 * time.Hour )
Variables ¶
View Source
var FeatureList []Feature = []Feature{ {models.DahuaFeature_Camera, "camera", "Camera", "The device has a camera."}, }
View Source
var ValidStorage = []models.Storage{ models.StorageFTP, models.StorageSFTP, }
Functions ¶
func CreateDevice ¶
func CreateDevice(ctx context.Context, arg CreateDeviceParams) (int64, error)
func CreateEmail ¶
func CreateEmail(ctx context.Context, arg CreateEmailParams) (int64, error)
func CreateEventRule ¶
func CreateStorageDestination ¶
func CreateStorageDestination(ctx context.Context, arg StorageDestination) (int64, error)
func DeleteEvents ¶
func DeleteStream ¶
func DeleteStream(ctx context.Context, stream repo.DahuaStream) error
func FeatureFromStrings ¶
func FeatureFromStrings(featureStrings []string) models.DahuaFeature
func FeatureToStrings ¶
func FeatureToStrings(feature models.DahuaFeature) []string
func FileFTPReadCloser ¶
func FileLocalDownload ¶
func FileLocalDownload(ctx context.Context, client Client, fileID int64, fileFilePath, fileType string) error
FileLocalDownload downloads file from device and saves it to the afero file system.
func FileLocalReadCloser ¶
func FileSFTPReadCloser ¶
func GetCoaxialCaps ¶
func GetCoaxialStatus ¶
func GetDahuaDetail ¶
func GetLicenseList ¶
func GetLiveRTSPURL ¶
func GetLiveRTSPURL(arg GetLiveRTSPURLParams) string
func GetRPCStatus ¶
func GetSoftwareVersion ¶
func GetStorage ¶
func GetSunriseSunset ¶
func ListDevices ¶
func ListDevices(ctx context.Context) ([]repo.DahuaDevice, error)
func ListEventRules ¶
func ListEventRules(ctx context.Context) ([]repo.DahuaEventRule, error)
func ListLatestFiles ¶
func ListPresets ¶
func ListStreams ¶
func LoginSMTP ¶
func LoginSMTP(ctx context.Context, arg LoginSMTPParams) (repo.DahuaDevice, error)
func NewDahuaEvent ¶
func NewDahuaEvent(v repo.DahuaEvent) models.DahuaEvent
func NewDahuaFile ¶
func NewDahuaFile(file mediafilefind.FindNextFileInfo, affixSeed int, location *time.Location) (models.DahuaFile, error)
func NewDahuaFiles ¶
func NewDahuaFiles(files []mediafilefind.FindNextFileInfo, affixSeed int, location *time.Location) ([]models.DahuaFile, error)
func PubSubMiddleware ¶
func PubSubMiddleware(ctx context.Context) pubsub.MiddlewareFunc
func PushStreams ¶
PushStreams pushes streams to mediamtx
func Scan ¶
func Scan(ctx context.Context, rpcClient dahuarpc.Conn, device Conn, scanType models.DahuaScanType) error
Scan cannot be called concurrently for the same device.
func ScannerScan ¶
func ScannerScan( ctx context.Context, rpcClient dahuarpc.Conn, scanPeriod ScannerPeriod, location *time.Location, resC chan<- []mediafilefind.FindNextFileInfo, ) (context.CancelFunc, <-chan error)
func StorageFromFilePath ¶
func SupportStream ¶
func SupportStream(feature models.DahuaFeature) bool
func SyncStreams ¶
SyncStreams fetches streams from device and sync them with database.
func SyncSunriseSunset ¶
func TestStorageDestination ¶
func TestStorageDestination(ctx context.Context, arg StorageDestination) error
func UpdateDevice ¶
func UpdateDevice(ctx context.Context, arg UpdateDeviceParams) error
func UpdateDeviceDisabled ¶
func UpdateEventRule ¶
func UpdateEventRule(ctx context.Context, arg repo.DahuaUpdateEventRuleParams) error
func UpdateStorageDestination ¶
func UpdateStorageDestination(ctx context.Context, arg StorageDestination) error
func UpdateStream ¶
func UpdateStream(ctx context.Context, stream repo.DahuaStream, arg repo.DahuaUpdateStreamParams) (repo.DahuaStream, error)
Types ¶
type Client ¶
type CoaxialWorker ¶
type CoaxialWorker struct {
// contains filtered or unexported fields
}
CoaxialWorker publishes coaxial status to the bus.
func NewCoaxialWorker ¶
func NewCoaxialWorker(hooks WorkerHooks, deviceID int64) CoaxialWorker
func (CoaxialWorker) String ¶
func (w CoaxialWorker) String() string
type Conn ¶
type Conn struct { ID int64 URL *url.URL Username string Password string Location *time.Location Feature models.DahuaFeature Seed int }
Conn is the bare minumum information required to create a connection to a Dahua device.
type CountFilesByMonthResult ¶
func CountFilesByMonth ¶
func CountFilesByMonth(ctx context.Context, filter FileFilter) ([]CountFilesByMonthResult, error)
type CreateDeviceParams ¶
type CreateEmailParams ¶
type DefaultWorkerHooks ¶
type DefaultWorkerHooks struct { }
func NewDefaultWorkerHooks ¶
func NewDefaultWorkerHooks() DefaultWorkerHooks
type Email ¶
type Email struct { Message repo.DahuaEmailMessage Attachments []repo.DahuaEmailAttachment }
type EmailContent ¶
type EmailContent struct { AlarmEvent string AlarmInputChannel int AlarmDeviceName string AlarmName string IPAddress string }
func ParseEmailContent ¶
func ParseEmailContent(text string) EmailContent
type EmailFilter ¶
type EventFilter ¶
type EventWorker ¶
type EventWorker struct {
// contains filtered or unexported fields
}
EventWorker publishes events to bus.
func NewEventWorker ¶
func NewEventWorker(hooks WorkerHooks, conn Conn) EventWorker
func (EventWorker) String ¶
func (w EventWorker) String() string
type Feature ¶
type Feature struct { models.DahuaFeature Value string Name string Description string }
type FileFilter ¶
type GetEmailAroundParams ¶
type GetEmailAroundParams struct { ID int64 EmailFilter }
type GetEmailAroundResult ¶
func GetEmailAround ¶
func GetEmailAround(ctx context.Context, arg GetEmailAroundParams) (GetEmailAroundResult, error)
type GetEmailParams ¶
type GetEmailParams struct { EmailFilter ID int64 }
type GetEmailResult ¶
type GetEmailResult struct { NextEmailID int64 Message repo.DahuaEmailMessage Attachments []repo.DahuaListEmailAttachmentsForMessageRow Filter EmailFilter }
func GetEmail ¶
func GetEmail(ctx context.Context, arg GetEmailParams) (GetEmailResult, error)
type GetEmailResultAttachments ¶
type GetEmailResultAttachments struct { repo.DahuaEmailAttachment repo.DahuaAferoFile }
type GetLiveRTSPURLParams ¶
type ListEmailsParams ¶
type ListEmailsParams struct { pagination.Page EmailFilter Ascending bool }
type ListEmailsResult ¶
type ListEmailsResult struct { pagination.PageResult Items []ListEmailsResultItems }
func ListEmails ¶
func ListEmails(ctx context.Context, arg ListEmailsParams) (ListEmailsResult, error)
type ListEmailsResultItems ¶
type ListEmailsResultItems struct { repo.DahuaEmailMessage DeviceName string AttachmentCount int }
type ListEventsParams ¶
type ListEventsParams struct { pagination.Page Ascending bool EventFilter }
type ListEventsResult ¶
type ListEventsResult struct { pagination.PageResult Items []ListEventsResultItems }
func ListEvents ¶
func ListEvents(ctx context.Context, arg ListEventsParams) (ListEventsResult, error)
type ListEventsResultItems ¶
type ListEventsResultItems struct { repo.DahuaEvent DeviceName string }
type ListFilesParams ¶
type ListFilesParams struct { pagination.Page Ascending bool Filter FileFilter }
type ListFilesResult ¶
type ListFilesResult struct { pagination.PageResult Items []ListFilesResultItems }
func ListFiles ¶
func ListFiles(ctx context.Context, arg ListFilesParams) (ListFilesResult, error)
type ListFilesResultItems ¶
type ListLatestEmailsResult ¶
type ListLatestEmailsResult struct { repo.DahuaEmailMessage AttachmentCount int64 }
func ListLatestEmails ¶
func ListLatestEmails(ctx context.Context, count int) ([]ListLatestEmailsResult, error)
type LoginSMTPParams ¶
type QuickScanWorker ¶
type QuickScanWorker struct {
// contains filtered or unexported fields
}
QuickScanWorker scans devices for files.
func NewQuickScanWorker ¶
func NewQuickScanWorker(hooks WorkerHooks, pub *pubsub.Pub, deviceID int64) QuickScanWorker
func (QuickScanWorker) String ¶
func (w QuickScanWorker) String() string
type ScanLocker ¶
func NewScanLocker ¶
func NewScanLocker() ScanLocker
type ScannerPeriod ¶
ScannerPeriod is INCLUSIVE Start and EXCLUSIVE End.
type ScannerPeriodIterator ¶
type ScannerPeriodIterator struct {
// contains filtered or unexported fields
}
ScannerPeriodIterator generates scan periods that are equal to or less than MaxScanPeriod.
func NewScannerPeriodIterator ¶
func NewScannerPeriodIterator(scanRange models.TimeRange) *ScannerPeriodIterator
func (*ScannerPeriodIterator) Cursor ¶
func (s *ScannerPeriodIterator) Cursor() time.Time
func (*ScannerPeriodIterator) Next ¶
func (s *ScannerPeriodIterator) Next() (ScannerPeriod, bool)
func (*ScannerPeriodIterator) Percent ¶
func (s *ScannerPeriodIterator) Percent() float64
type StorageDestination ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds clients.
type Thumbnail ¶
type Thumbnail struct { repo.DahuaThumbnail // contains filtered or unexported fields }
func CreateThumbnail ¶
type ThumbnailForeignKeys ¶
type UpdateDeviceParams ¶
type Worker ¶
type Worker struct { DeviceID int64 Type models.DahuaWorkerType }
type WorkerFactory ¶
type WorkerHooks ¶
type WorkerManager ¶
type WorkerManager struct {
// contains filtered or unexported fields
}
WorkerManager manages devices workers.
func NewWorkerManager ¶
func NewWorkerManager(super *suture.Supervisor, factory WorkerFactory) *WorkerManager
func (*WorkerManager) Delete ¶
func (m *WorkerManager) Delete(id int64) error
func (*WorkerManager) Register ¶
func (m *WorkerManager) Register() *WorkerManager
func (*WorkerManager) String ¶
func (*WorkerManager) String() string
Click to show internal directories.
Click to hide internal directories.