Documentation ¶
Overview ¶
Package dms3libs audio provides audio services for dms3 device components
Package dms3libs configuration structures and variables ¶
Package dms3libs detector provides motion detector application services for dms3 device components
Package dms3libs file provides file services for dms3 device components ¶
Package dms3libs log provides logging services for dms3 device components ¶
Package dms3libs network provides networking services for dms3 device components ¶
Package dms3libs OS provides operating system information services for dms3 device components ¶
Package dms3libs process provides process-related services for dms3 device components ¶
Package dms3libs util provides utility services for dms3 device components
Index ¶
- Variables
- func CheckErr(err error)
- func CheckFileLocation(configPath string, fileDir string, fileLocation *string, filename string)
- func CopyDir(srcDir string, destDir string)
- func CopyFile(src string, dest string)
- func CountFilesInDir(srcDir string) int
- func CreateLogger(logger *StructLogging)
- func FindMacs(macsToFind []string) bool
- func Format24H(time string) string
- func FormatDateTime(value time.Time) string
- func GetDeviceDetails(element DeviceDetails) string
- func GetDeviceHostname() string
- func GetDeviceOSName() string
- func GetFunctionName() string
- func GetGitVersion() string
- func GetImageDimensions(imagePath string) (int, int)
- func GetPackageDir() string
- func IsFile(filename string) bool
- func IsRunning(application string) bool
- func LoadComponentConfig(structConfig interface{}, configFile string)
- func LoadLibConfig(configFile string)
- func LogDebug(msg string)
- func LogFatal(msg string)
- func LogInfo(msg string)
- func MkDir(newPath string)
- func ModVal(number int, val int) int
- func PingHosts(ipBase string, ipRange []int)
- func PlayAudio(audioFile string)
- func RmDir(dir string)
- func RunCommand(cmd string) (res []byte, err error)
- func SecondsSince(value time.Time) uint32
- func SetLogFileLocation(config *StructLogging)
- func StartStopApplication(state MotionDetectorState, application string) bool
- func StripRet(value []byte) []byte
- func To24H(value time.Time) string
- func Uptime(startTime time.Time) string
- func WalkDir(dirname string) map[string]int
- type DeviceDetails
- type MotionDetectorState
- type StructLogging
Constants ¶
This section is empty.
Variables ¶
global logging objects
var LibConfig *structConfig
LibConfig contains dms3Libs configuration settings read from TOML file
var MotionDetector = structMotionDetector{ // contains filtered or unexported fields }
MotionDetector is the motion detector application running on the clients (e.g., motion)
Functions ¶
func CheckErr ¶
func CheckErr(err error)
CheckErr does simple error management (no logging dependencies)
func CheckFileLocation ¶
CheckFileLocation checks/sets the location of file and pathname passed in as defined in various TOML config files, returning a fully qualified path
func CountFilesInDir ¶
CountFilesInDir recursively counts the files in the dir passed in
func CreateLogger ¶
func CreateLogger(logger *StructLogging)
CreateLogger creates an application log file (1) or redirects to STDOUT (2) based on logDevice
func FindMacs ¶
FindMacs uses 'ip neigh' to find mac address(es) passed in, returning true if any mac passed in is found (e.g., mac1|mac2|mac3)
func FormatDateTime ¶
FormatDateTime formats time to "date at time"
func GetDeviceDetails ¶
func GetDeviceDetails(element DeviceDetails) string
GetDeviceDetails returns device details of the local machine
func GetDeviceHostname ¶
func GetDeviceHostname() string
GetDeviceHostname returns the name of the local machine
func GetDeviceOSName ¶
func GetDeviceOSName() string
GetDeviceOSName returns the OS release name (NAME) and version ID (VERSION_ID) from a parse of the /etc/os-release file found in most Linux-based distributions
func GetFunctionName ¶
func GetFunctionName() string
GetFunctionName uses reflection (runtime) to return current function name
func GetGitVersion ¶
func GetGitVersion() string
FUTURE USE: GetGitVersion queries the external git runtime for the most recent version tag, returning a string to the caller
func GetImageDimensions ¶
GetImageDimensions returns the (width, height) of an image passed in
func GetPackageDir ¶
func GetPackageDir() string
GetPackageDir returns the absolute path of the calling package
func LoadComponentConfig ¶
func LoadComponentConfig(structConfig interface{}, configFile string)
LoadComponentConfig loads a TOML configuration file of client/server configs into parameter values
func LoadLibConfig ¶
func LoadLibConfig(configFile string)
LoadLibConfig loads a TOML configuration file of system commands into parameter values
func LogDebug ¶
func LogDebug(msg string)
LogDebug generates a debug log message based on loggingLevel
func LogFatal ¶
func LogFatal(msg string)
LogFatal generates a fatal log message based on loggingLevel
func LogInfo ¶
func LogInfo(msg string)
LogInfo generates an informational log message based on loggingLevel
func PingHosts ¶
PingHosts uses native ping command to ping the address range passed in to freshen the local arp cache
func PlayAudio ¶
func PlayAudio(audioFile string)
PlayAudio uses the shell aplay command (system default) to play audioFile
func RunCommand ¶
RunCommand is a simple wrapper for the exec.Command() call
NOTE: this call is blocking (non-threaded), and will return only after the command completes
func SecondsSince ¶
SecondsSince returns seconds passed since value passed
func SetLogFileLocation ¶
func SetLogFileLocation(config *StructLogging)
SetLogFileLocation sets the location of the log file based on TOML configuration
func StartStopApplication ¶
func StartStopApplication(state MotionDetectorState, application string) bool
StartStopApplication enable/disables the application passed in
Types ¶
type DeviceDetails ¶
type DeviceDetails int
DeviceDetails defines the set of available device details available in GetDeviceDetails
const ( Sysname DeviceDetails = iota Machine Release )
types of DMS3 devices
type MotionDetectorState ¶
type MotionDetectorState int
MotionDetectorState defines the motion detector application state type
const ( Stop MotionDetectorState = iota Start )
states of the motion detector application