示例#1
0
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()
}
示例#2
0
func (s *HackSession) SetDevice(dev api.CanDevice) {
	s.Device = dev
	s.DeviceId = dev.GetId()
}