123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package iot
- import (
- "log"
- "net/http"
- )
- /*
- IoT Handler Manager
- Author: tobychui
- This manager mange all the existsing / registered ioT Manager.
- This allow a much more abstract usage in the main code
- */
- type Manager struct {
- RegisteredHandler []ProtocolHandler
- }
- func NewIoTManager() *Manager {
- return &Manager{
- RegisteredHandler: []ProtocolHandler{},
- }
- }
- //Register the handler as one of the IoT Protocol Handler.
- func (m *Manager) RegisterHandler(h ProtocolHandler) error {
- //Try to start the handler
- err := h.Start()
- if err != nil {
- //Handler startup failed
- log.Println("*IoT* Protocol Handler Startup Failed: ", err.Error())
- return err
- }
- //Add it to the handlers
- m.RegisteredHandler = append(m.RegisteredHandler, h)
- return nil
- }
- //Handle IoT Scanning Request
- func (m *Manager) HandleScanning(w http.ResponseWriter, r *http.Request) {
- }
|