3 Commits

Author SHA1 Message Date
4c631db418 Добавен новый раздел настроек и добавлены комментарии к некоторым другим разделам 2025-05-17 19:10:22 +03:00
26f354d82d Remove unused counter logic in live source callback
The incrementing counter and related condition were unnecessary and have been removed. This simplifies the callback function and improves code clarity without altering functionality.
2025-05-16 17:43:51 +03:00
edc86fb706 Added auto channel creation 2025-04-28 17:10:27 +03:00
3 changed files with 55 additions and 16 deletions

View File

@ -116,16 +116,8 @@ func handleLogin(sPack *smart.SmartPackage, pack protocol.Package) (err error) {
go videoPack.Run()
i := 0
videoPack.AddLiveSource(2, func(data []byte) error {
fmt.Println("Есть контакт!")
i++
if i > 10 {
return errors.New("я устал")
}
return nil
})

View File

@ -152,6 +152,8 @@ type SAP struct {
UN int
}
// 7.24.3
// Alarm processing parameters
type APR struct {
AR ARR
SS SS
@ -167,13 +169,6 @@ type SS struct {
EN int
}
type UAP struct {
EN int
AS int
VT int
SDT int
}
type PVLAS struct {
EN int
AS int
@ -257,8 +252,10 @@ type MCMS struct {
SP []SP // Параметры сервера
}
// 7.12.1
// Central server configuration
type SP struct {
EN int // Статус сервера
EN int // Флаг включения
CP int // Протокол подключения
NWT int // Способ подключения
CS string // Адрес сервера
@ -269,7 +266,45 @@ type SP struct {
MUPORT int // UDP-порт медиасервера
}
// 7.28
// NVR remote device parameters
type REDEV struct {
EN int // Флаг включения
LOCK int // ???
CHL int // Номер канала на устройстве
RECHL int // ???
ONLINE int // Доступно ли сейчас устройство
RETYPE int // Тип устройства
PROTYPE int // Тип протокола
IPTYPE int // Тип IP-адреса (IPv4/IPv6)
CONTYPE int // ???
SW int // Источник поступаемого сигнала
REPORT int // Порт камеры
REIP int // IP камеры
ID int // Идентификатор камеры
RENAME string // Название устройства
USER string // Имя пользователя
PWD string // Пароль
URL string // ???
CMDPORT string // ???
}
// 7.29
// Panel emergency alarm
type UAP struct {
EN int // Флаг включения
AS int // Уровень тревоги
T int // ???
VT int // ???
UN string // Имя тревоги
UO string // Имя тривоги на экране водителя
APR APR // Параметры обработки тревоги
// AP AP // Параметры тревоги
SDT int // ???
}
// 7.30
// Network monitoring status parameters
type PGDSM struct {
PGPS PGPS `json:"PGPS,omitempty"`
PDSM PDSM `json:"PDSM,omitempty"`
@ -286,6 +321,7 @@ type PGPS struct {
}
// 7.30.2
// Device status parameter
type PDSM struct {
}
@ -323,6 +359,7 @@ type Setting struct {
EOSD []EOSD `json:"EOSD,omitempty"`
IOP []IOP `json:"IOP,omitempty"`
SAP SAP `json:"SAP,omitempty"`
REDEV []REDEV `json:"REDEV,omitempty"`
UAP UAP `json:"UAP,omitempty"`
PGDSM PGDSM `json:"PGDSM,omitempty"`
PVLAS PVLAS `json:"PVLAS,omitempty"`

View File

@ -14,6 +14,16 @@ const (
length = 6
)
func NewAutoSmartChannelPackage(mainSmartPackage *SmartPackage) (*SmartChannelPackage, error) {
conn, err := net.Dial(mainSmartPackage.conn.RemoteAddr().Network(), mainSmartPackage.conn.RemoteAddr().String())
if err != nil {
return nil, err
}
return NewSmartChannelPackage(conn, mainSmartPackage)
}
func NewSmartChannelPackage(conn net.Conn, mainSmartPackage *SmartPackage) (*SmartChannelPackage, error) {
pack := NewSmartPackage(conn)
pack.pack.Payload.Session = mainSmartPackage.pack.Payload.Session