func (c *Config) AppendDriver(drv api.CanDevice) int { var next_id int next_id = 0 for i := range c.Drivers { if next_id <= c.Drivers[i].GetId() { next_id = c.Drivers[i].GetId() } } next_id += 1 drv.SetId(next_id) c.Drivers = append(c.Drivers, drv) return drv.GetId() }
func (s *HackSession) SetDevice(dev api.CanDevice) { s.Device = dev s.DeviceId = dev.GetId() }