private void GetCaps() { ConnectIfNeeded(); Trace.WriteLine("checking caps.."); if (Capabilities == "") { Trace.WriteLine("requesting caps..."); var req = new Packets.Request(); req.Type = Packets.Request.RequestType.Capabilities; req.UID = UID; sock.Send(req); int c = 0; while (Capabilities == "") { Trace.WriteLine("Waiting for caps..."); Thread.Sleep(100); c++; if (c > 20) { Capabilities = "unk"; return; } } } }
protected void StopVideoInternal() { var req = new Packets.Request(); req.Type = Packets.Request.RequestType.StopVideo; req.UID = UID; sock.Send(req); }
protected void StartVideoInternal() { ConnectIfNeeded(); var req = new Packets.Request(); req.UID = UID; req.Type = Packets.Request.RequestType.StartVideo; sock.Send(req); Trace.WriteLine("Requested feed"); }
void sock_XmlDataArrived(TSocket sock, TSocket.DataPacket data) { switch (data.Type) { case "Unity.Packets.Error": var err = data.GetObject <Packets.Error>(); Trace.WriteLine("Error: " + err.Message); OnError(err.Message); break; case "Unity.Packets.FrameNotReady": Trace.WriteLine("up to date, requesting again..."); var req = new Packets.Request(); req.Type = Packets.Request.RequestType.Frame; req.UID = UID; sock.Send(req); break; case "Unity.Packets.Capabilities": var caps = data.GetObject <Packets.Capabilities>(); Trace.WriteLine("Got caps: " + caps.Caps); for (int i = 0; i < caps.Modes.Count; i++) { if (caps.Modes[i].Text == "-") { Modes.Add(new CamServerCore.SeparatorMode(), false); } else { Modes.Add(caps.Modes[i], caps.ModeValues[i]); } } Capabilities = caps.Caps; break; case "Unity.Packets.ModeChange": var mode = data.GetObject <Packets.ModeChange>(); Trace.WriteLine("got mode state change"); if (ModeStateChanged != null) { ModeStateChanged(mode.Mode, mode.value); } break; default: Trace.WriteLine("Got unhandled xml " + data.Type); break; } }
bool sock_BinaryDataArrived(TSocket sock, string type, byte[] data) { if (type == "jpeg") { // dispatch jpeg OnFrame(getBitmap(data)); var req = new Packets.Request(); req.Type = Packets.Request.RequestType.Frame; req.UID = UID; sock.Send(req); return(true); } return(false); }