Пример #1
0
func (o *OpenHABPusher) AddMonitoredMAC(macAddress, itemName string) error {
	hwAddr, err := net.ParseMAC(macAddress)
	if err != nil {
		return err
	}
	key := store.ConvertHWAddr(probecollector.HardwareAddr(hwAddr))
	o.monitoredMACs[key] = itemName
	return nil
}
Пример #2
0
func (m *MemoryStore) FindLastProbeRequest(hwaddr net.HardwareAddr) *probecollector.ProbeRequest {
	searchKey := ConvertHWAddr(probecollector.HardwareAddr(hwaddr))
	m.lock.Lock()
	pr, exists := m.requestMap[searchKey]
	m.lock.Unlock()
	if !exists {
		return nil
	}
	return &pr
}