sirius/model/sirius.go
2023-04-15 00:51:35 +10:00

258 lines
4.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
// Sirius structure
type Sirius struct {
Device `json:"device"`
Zone `json:"zone"`
ZoneGroup `json:"zone_group"`
Input `json:"input"`
Output `json:"output"`
Reader `json:"reader"`
Channel `json:"channel"`
AccessGroup `json:"access_group"`
User `json:"user"`
Script `json:"script"`
Program `json:"program"`
Controller `json:"controller"`
}
// Device
type Device struct {
Keys []string `json:"keys"`
Rows [][]interface{} `json:"rows"`
}
func (z *Device) Get() []DeviceRows {
var zr []DeviceRows
for _, z := range z.Rows {
i, b, s, _ := InterToArray(z)
zz := DeviceRows{
DevID: i[0],
I2: i[1],
B1: b[0],
Addr: i[2],
I4: i[3],
Type: i[4],
I6: i[5],
I7: i[6],
I8: i[7],
I9: i[8],
Name: s[0],
}
zr = append(zr, zz)
}
return zr
}
// Type-40(КДЛС-С) Type-81(КДЛ-2И)
type DeviceRows struct {
DevID int64
I2 int64
B1 bool
Addr int64
I4 int64
Type int64
I6 int64
I7 int64
I8 int64
I9 int64
IntArr1 []int64
IntArr2 []int64
Name string
}
// Zone
type Zone struct {
Keys []string `json:"keys"`
Rows [][]interface{} `json:"rows"`
}
func (z *Zone) Get() []ZoneRows {
var zr []ZoneRows
for _, z := range z.Rows {
i, b, s, _ := InterToArray(z)
zz := ZoneRows{
ZoneID: i[0],
I1: i[1],
B1: b[0],
Number: i[2],
I3: i[3],
I4: i[4],
B2: b[1],
B3: b[2],
Name: s[0],
}
zr = append(zr, zz)
}
return zr
}
type ZoneRows struct {
ZoneID int64
I1 int64
B1 bool
Number int64
I3 int64
I4 int64
B2 bool
B3 bool
Name string
}
// ZoneGroup
type ZoneGroup struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// type ZoneGroupRows struct {
// Number int64
// I2 int64
// B1 bool
// I3 int64
// I4 int64
// IntArr []int64
// Name string
// }
// Input
type Input struct {
Keys []string `json:"keys"`
Rows [][]interface{} `json:"rows"`
}
func (z *Input) Get() []InputRows {
var zr []InputRows
for _, z := range z.Rows {
i, _, s, _ := InterToArray(z)
zz := InputRows{
InputID: i[0],
DevID: i[1],
AddrU: i[2],
I4: i[3],
I5: i[4],
I6: i[5],
ZoneID: i[6],
I8: i[7],
Name: s[0],
}
zr = append(zr, zz)
}
return zr
}
type InputRows struct {
InputID int64
DevID int64
AddrU int64
I4 int64
I5 int64
I6 int64
ZoneID int64
I8 int64
Name string
}
// Output
type Output struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// type OutputRows struct {
// Addr int64
// I2 int64
// I3 int64
// I4 int64
// I5 int64
// I6 int64
// I7 int64
// I8 int64
// I9 int64
// I10 int64
// I11 int64
// IntArr1 []int64
// IntArr2 []int64
// I12 int64
// I13 int64
// Name string
// }
// Reader
type Reader struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// type ReaderRows struct {
// I1 int64
// I2 int64
// I3 int64
// I4 int64
// I5 int64
// I6 int64
// IntArr1 []int64
// IntArr2 []int64
// Name string
// }
// Channel
type Channel struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// type ChannelRows struct {
// I1 int64
// I2 int64
// I3 int64
// I4 int64
// I5 int64
// Name string
// }
// AccessGroup
type AccessGroup struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// type AccessGroupRows struct {
// I1 int64
// I2 int64
// IntArr1 []AccessGroupIntArray
// Name string
// }
// type AccessGroupIntArray struct {
// I1 int64
// I2 int64
// }
// User
type User struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// Script
type Script struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// Program
type Program struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// Controller
type Controller struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}