Ejemplo n.º 1
0
 public WebSocketService NewServiceMap(WebSocketServiceManager _manager, IWebSocketConnection socket)
 {
     WebSocketService service = null;
     switch (_manager.managerName)
     {
         case "/" + TargetDeiveName.GPS:
             service = new GPSService(_manager, socket);
             break;
         case "/" + TargetDeiveName.UHF:
             service = new UHFService(_manager, socket);
             break;
         case "/" + TargetDeiveName.绿灯:
             service = new GreenLightService(_manager, socket);
             break;
         case "/" + TargetDeiveName.红灯:
             service = new RedLightService(_manager, socket);
             break;
         case "/" + TargetDeiveName.黄灯:
             service = new YellowLightService(_manager, socket);
             break;
         case "/" + TargetDeiveName.电风扇:
             service = new FanService(_manager, socket);
             break;
         case "/" + TargetDeiveName.电机:
             service = new EngineService(_manager, socket);
             break;
     }
     return service;
 }
Ejemplo n.º 2
0
 public WebSocketService NewServiceMap(WebSocketServiceManager _manager, IWebSocketConnection socket)
 {
     WebSocketService service = null;
     switch (_manager.managerName)
     {
         case "/gps":
             service = new GPSService(_manager, socket);
             //service.
             break;
         case "/uhf":
             service = new UHFService(_manager, socket);
             break;
         case "/green_light":
             service = new GreenLightService(_manager, socket);
             break;
         case "/red_light":
             service = new RedLightService(_manager, socket);
             break;
         case "/yellow_light":
             service = new YellowLightService(_manager, socket);
             break;
         case "/fan":
             service = new FanService(_manager, socket);
             break;
         case "/engine":
             service = new EngineService(_manager, socket);
             break;
     }
     return service;
 }
Ejemplo n.º 3
0
 public FanService(WebSocketServiceManager _manager, IWebSocketConnection socket)
 {
     services.register_service("fan", this);
     this.ID = socket.ConnectionInfo.Id.ToString();
     this._manager = _manager;
     this._websocket = socket;
     this._context = socket.ConnectionInfo;
 }
Ejemplo n.º 4
0
 public WebSocketServiceManager addConnectionManager(string name, List<WebSocketServiceManager> groupList)
 {
     WebSocketServiceManager group = groupList.Find((_group) =>
     {
         return name == _group.managerName;
     });
     if (group == null)
     {
         WebSocketServiceManager newGroup = new WebSocketServiceManager(name);
         groupList.Add(newGroup);
         return newGroup;
     }
     return group;
 }
Ejemplo n.º 5
0
        public UHFService(WebSocketServiceManager _manager, IWebSocketConnection socket)
        {
            services.register_service("uhf", this);
            this.ID = socket.ConnectionInfo.Id.ToString();
            this._manager = _manager;
            this._websocket = socket;
            this._context = socket.ConnectionInfo;

            rfid_helper = new TDJ_RFIDHelper();

            //��UDP�˿ڣ��ȴ����ݴ���
            this.updServer = UDPServer.getUDPServer(Program.UHF_UDP_Port);
            updServer.evtReceived += new OnReceiveString(updServer_evtReceived);
            updServer.startUDPListening();
        }
Ejemplo n.º 6
0
        public WebSocketServiceManager addConnectionManager(string name, List <WebSocketServiceManager> groupList)
        {
            WebSocketServiceManager group = groupList.Find((_group) =>
            {
                return(name == _group.managerName);
            });

            if (group == null)
            {
                WebSocketServiceManager newGroup = new WebSocketServiceManager(name);
                groupList.Add(newGroup);
                return(newGroup);
            }
            return(group);
        }
Ejemplo n.º 7
0
        public WebSocketService NewServiceMap(WebSocketServiceManager _manager, IWebSocketConnection socket)
        {
            WebSocketService service = null;

            switch (_manager.managerName)
            {
            case "/gps":
                service = new GPSService(_manager, socket);
                //service.
                break;

            case "/uhf":
                service = new UHFService(_manager, socket);
                break;

            case "/green_light":
                service = new GreenLightService(_manager, socket);
                break;

            case "/red_light":
                service = new RedLightService(_manager, socket);
                break;

            case "/yellow_light":
                service = new YellowLightService(_manager, socket);
                break;

            case "/fan":
                service = new FanService(_manager, socket);
                break;

            case "/engine":
                service = new EngineService(_manager, socket);
                break;
            }
            return(service);
        }
Ejemplo n.º 8
0
        public void FMSend(string _message)
        {
            command cmd_temp = (command)JsonConvert.DeserializeObject(_message, typeof(command));

            if (cmd_temp != null && cmd_temp.Initializing == "true")
            {
                WebSocketServiceManager.Broadcast2LocalService(cmd_temp);
                return;
            }

            var manager = GetWebSocketServiceManager("/" + cmd_temp.TargetDevice, service_list);

            if (manager != null)
            {
                if (cmd_temp.IfBroadcast == "true")
                {
                    manager.Broadcast(_message);
                }
                else
                {
                    manager.FMSend(_message, cmd_temp.id);
                }
            }
        }
Ejemplo n.º 9
0
        public WebSocketService NewServiceMap(WebSocketServiceManager _manager, IWebSocketConnection socket)
        {
            WebSocketService service = null;

            switch (_manager.managerName)
            {
            case "/" + TargetDeiveName.GPS:
                service = new GPSService(_manager, socket);
                break;

            case "/" + TargetDeiveName.UHF:
                service = new UHFService(_manager, socket);
                break;

            case "/" + TargetDeiveName.绿灯:
                service = new GreenLightService(_manager, socket);
                break;

            case "/" + TargetDeiveName.红灯:
                service = new RedLightService(_manager, socket);
                break;

            case "/" + TargetDeiveName.黄灯:
                service = new YellowLightService(_manager, socket);
                break;

            case "/" + TargetDeiveName.电风扇:
                service = new FanService(_manager, socket);
                break;

            case "/" + TargetDeiveName.电机:
                service = new EngineService(_manager, socket);
                break;
            }
            return(service);
        }