Example #1
0
 public void ConnectTo(ulong userID)
 {
     // ID comparison is used to decide who initiates and who gets the Callback
     if (SocialPlatformManager.MyID < userID)
     {
         Voip.Start(userID);
         SocialPlatformManager.LogOutput("Voip connect to " + userID);
     }
 }
Example #2
0
    void VoipConnectRequestCallback(Message <NetworkingPeer> msg)
    {
        Debug.LogFormat("Voip request from {0}, authorized is {1}", msg.Data.ID, m_remoteID);

        if (msg.Data.ID == m_remoteID)
        {
            Voip.Accept(msg.Data.ID);
        }
    }
Example #3
0
 public void Disconnect()
 {
     if (m_remoteID != 0)
     {
         Voip.Stop(m_remoteID);
         Object.Destroy(m_remoteHead.GetComponent <VoipAudioSourceHiLevel>(), 0);
         m_remoteID = 0;
         m_state    = PeerConnectionState.Unknown;
     }
 }
Example #4
0
    void VoipConnectRequestCallback(Message<NetworkingPeer> msg)
    {
       PlatformManager.LogOutput("Voip request from " + msg.Data.ID):

       RemotePlayer remote = PlatformManager.GetRemoteUser(msg.Data.ID):
       if (remote != null)
       {
            PlatformManager.LogOutput("Voip request accepted from " + msg.Data.ID):
            Voip.Accept(msg.Data.ID):
        }
    }
Example #5
0
    void VoipConnectRequestCallback(Message <Oculus.Platform.Models.NetworkingPeer> msg)
    {
        SocialPlatformManager.LogOutput("Voip request from " + msg.Data.ID);

        RemotePlayer remote = SocialPlatformManager.GetRemoteUser(msg.Data.ID);

        if (remote != null)
        {
            SocialPlatformManager.LogOutput("Voip request accepted from " + msg.Data.ID);
            Voip.Accept(msg.Data.ID);
        }
    }
Example #6
0
    public void ConnectTo(ulong userID)
    {
        m_remoteID = userID;
        var audioSource = m_remoteHead.AddComponent <VoipAudioSourceHiLevel>();

        audioSource.senderID = userID;

        // ID comparison is used to decide who initiates and who gets the Callback
        if (PlatformManager.MyID < m_remoteID)
        {
            Voip.Start(userID);
        }
    }
Example #7
0
    public void Disconnect(ulong userID)
    {
        if (userID != 0)
        {
            Voip.Stop(userID);

            RemotePlayer remote = SocialPlatformManager.GetRemoteUser(userID);
            if (remote != null)
            {
                remote.voipConnectionState = PeerConnectionState.Unknown;
            }
        }
    }
Example #8
0
    void OnRemoteClientDisconnected(int clientId, ulong userId, string userName)
    {
        Debug.Log(userName + " disconnected");
        var head  = context.GetAvatarHead(clientId);
        var audio = head.GetComponent <VoipAudioSourceHiLevel>();

        if (audio)
        {
            audio.senderID = 0;
        }

        Voip.Stop(userId);
        context.HideAvatar(clientId);
    }
Example #9
0
    void OnRemoteClientConnected(int clientId, ulong userId, string userName)
    {
        Debug.Log(userName + " connected as client " + clientId);
        context.ShowAvatar(clientId);
        Voip.Start(userId);
        var head  = context.GetAvatarHead(clientId);
        var audio = head.GetComponent <VoipAudioSourceHiLevel>();

        if (!audio)
        {
            audio = head.AddComponent <VoipAudioSourceHiLevel>();
        }

        audio.senderID = userId;
    }
    void ShowAvatar(int id)
    {
        Log(clients[id].oculusId + " joined the game as client " + id);
        context.ShowAvatar(id);
        Voip.Start(clients[id].userId);

        var head  = context.GetAvatarHead(id);
        var audio = head.GetComponent <VoipAudioSourceHiLevel>();

        if (!audio)
        {
            audio = head.AddComponent <VoipAudioSourceHiLevel>();
        }

        audio.senderID = clients[id].userId;
    }
    void HideAvatar(int id)
    {
        Log(clients[id].oculusId + " left the game");
        var head  = context.GetAvatarHead(id);
        var audio = head.GetComponent <VoipAudioSourceHiLevel>();

        if (audio)
        {
            audio.senderID = 0;
        }

        Voip.Stop(clients[id].userId);
        context.HideAvatar(id);
        context.ResetAuthority(id);
        context.GetServerData(id).Reset();
    }
Example #12
0
    void OnClientConnect(int clientIndex)
    {
        Debug.Log(client[clientIndex].oculusId + " joined the game as client " + clientIndex);

        context.ShowRemoteAvatar(clientIndex);

        Voip.Start(client[clientIndex].userId);

        var headGameObject = context.GetRemoteAvatarHead(clientIndex);
        var audioSource    = headGameObject.GetComponent <VoipAudioSourceHiLevel>();

        if (!audioSource)
        {
            audioSource = headGameObject.AddComponent <VoipAudioSourceHiLevel>();
        }
        audioSource.senderID = client[clientIndex].userId;
    }
Example #13
0
    void VoipStateChangedCallback(Message<NetworkingPeer> msg)
    {
        PlatformManager.LogOutput("Voip state to " + msg.Data.ID + " changed to  " + msg.Data.State):

        RemotePlayer remote = PlatformManager.GetRemoteUser(msg.Data.ID):
        if (remote != null)
        {
            remote.voipConnectionState = msg.Data.State:

            // ID comparison is used to decide who initiates and who gets the Callback
            if (msg.Data.State == PeerConnectionState.Timeout && PlatformManager.MyID < msg.Data.ID)
            {
                    // keep trying until hangup!
                    Voip.Start(msg.Data.ID):
                    PlatformManager.LogOutput("Voip re-connect to " + msg.Data.ID):
            }
        }
    }
Example #14
0
    void VoipStateChangedCallback(Message <NetworkingPeer> msg)
    {
        Debug.LogFormat("Voip state to {0} changed to {1}", msg.Data.ID, msg.Data.State);

        if (msg.Data.ID == m_remoteID)
        {
            m_state = msg.Data.State;

            if (m_state == PeerConnectionState.Timeout &&
                // ID comparison is used to decide who initiates and who gets the Callback
                PlatformManager.MyID < m_remoteID)
            {
                // keep trying until hangup!
                Voip.Start(m_remoteID);
            }
        }

        PlatformManager.SetBackgroundColorForState();
    }
Example #15
0
    void OnClientDisconnect(int clientIndex)
    {
        Debug.Log(client[clientIndex].oculusId + " left the game");

        var headGameObject = context.GetRemoteAvatarHead(clientIndex);
        var audioSource    = headGameObject.GetComponent <VoipAudioSourceHiLevel>();

        if (audioSource)
        {
            audioSource.senderID = 0;
        }

        Voip.Stop(client[clientIndex].userId);

        context.HideRemoteAvatar(clientIndex);

        context.ResetAuthorityForClientCubes(clientIndex);

        context.GetServerConnectionData(clientIndex).Reset();
    }
Example #16
0
    new void Awake()
    {
        Debug.Log("*** GUEST ***");
        Assert.IsNotNull(context);
        state = LoggingIn;
        InitializePlatformSDK(CheckEntitlement);
        Matchmaking.SetMatchFoundNotificationCallback(JoinRoom);
        Rooms.SetUpdateNotificationCallback(CheckRoomConnection);
        Users.GetLoggedInUser().OnComplete(StartMatchmaking);
        Net.SetPeerConnectRequestCallback(AddConnection);
        Net.SetConnectionStateChangedCallback(CheckConnection);

        Voip.SetVoipConnectRequestCallback((Message <NetworkingPeer> message) => {
            Debug.Log("Accepting voice connection from " + message.Data.ID);
            Voip.Accept(message.Data.ID);
        });

        Voip.SetVoipStateChangeCallback((Message <NetworkingPeer> message) => {
            Debug.LogFormat("Voice state changed to {1} for user {0}", message.Data.ID, message.Data.State);
        });
    }
Example #17
0
    void OnVoipConnectRequestCallback(Message <NetworkingPeer> msg)
    {
        if (msg.IsError)
        {
            Debug.LogError("Voip connecton error - " + msg.GetError().Message);
        }
        else
        {
            var peer = msg.GetNetworkingPeer();

            if (!remoteConnectionStates.ContainsKey(peer.ID))
            {
                remoteConnectionStates.Add(peer.ID, new ConnectionStates());
            }

            UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "Voip accept of " + peer.ID.ToString() +
                                                      ".  State was " + remoteConnectionStates[peer.ID].voipState.ToString());

            Voip.Accept(peer.ID);
            remoteConnectionStates[peer.ID].voipState    = ConnectionState.Connecting;
            remoteConnectionStates[peer.ID].voipTimeouts = 0;
        }
    }
    new void Awake()
    {
        Log("*** HOST ***");
        IsNotNull(context);

        for (int i = 0; i < MaxClients; ++i) //IMPORTANT: the host is *always* client 0
        {
            clients[i].Reset();
        }

        context.Init(0);
        context.resetId = 100;
        InitializePlatformSDK(CheckEntitlement);
        Rooms.SetUpdateNotificationCallback(ConnectClients);
        Net.SetConnectionStateChangedCallback(CheckClientConnection);

        Voip.SetVoipConnectRequestCallback((Message <NetworkingPeer> message) => {
            Voip.Accept(message.Data.ID);
        });

        Voip.SetVoipStateChangeCallback((Message <NetworkingPeer> message) => {
            LogFormat("Voice state changed to {1} for user {0}", message.Data.ID, message.Data.State);
        });
    }
Example #19
0
        static void HandleElapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            System.Collections.Generic.Dictionary <string, string> dConfig = new System.Collections.Generic.Dictionary <string, string> ();

            if (!System.IO.Directory.Exists("dyndata"))
            {
                System.IO.Directory.CreateDirectory("dyndata");
            }

            bool Enable = false; string ConnectionStatus = "Unbekannt"; string PossibleConnectionTypes = "Unbekannt"; string ConnectionType = "Unbekannt"; string Name = "Unbekannt"; uint Uptime = 0; uint UpstreamMaxBitRate = 0; uint DownstreamMaxBitRate = 0; string LastConnectionError = ""; uint IdleDisconnectTime = 0; bool RSIPAvailable = false; string UserName = "******"; bool NATEnabled = false; string ExternalIPAddress = "0.0.0.0"; string DNSServers = "0.0.0.0"; string MACAddress = "::::"; string ConnectionTrigger = "Unbekannt"; string LastAuthErrorInfo = ""; ushort MaxCharsUsername = 0; ushort MinCharsUsername = 0; string AllowedCharsUsername = "******"; ushort MaxCharsPassword = 0; ushort MinCharsPassword = 0; string AllowedCharsPassword = "******"; string TransportType = "Unbekannt"; string RouteProtocolRx = "Unbekannt"; string PPPoEServiceName = "Unbekannt"; string RemoteIPAddress = "0.0.0.0"; string PPPoEACName = "Unbekannt"; bool DNSEnabled = false; bool DNSOverrideAllowed = false;

            try {
                Wanpppconn1 service = new Wanpppconn1("https://" + NetConfig["Gateway"] + ":" + NetConfig["GW-SSL-Port"]);
                service.SoapHttpClientProtocol.Credentials = new NetworkCredential(NetConfig["TR064-Username"], NetConfig["FRITZPass"]);
                service.GetInfo(out Enable, out ConnectionStatus, out PossibleConnectionTypes, out ConnectionType, out Name, out Uptime, out UpstreamMaxBitRate, out DownstreamMaxBitRate, out LastConnectionError, out IdleDisconnectTime, out RSIPAvailable, out UserName, out NATEnabled, out ExternalIPAddress, out DNSServers, out MACAddress, out ConnectionTrigger, out LastAuthErrorInfo, out MaxCharsUsername, out MinCharsUsername, out AllowedCharsUsername, out MaxCharsPassword, out MinCharsPassword, out AllowedCharsPassword, out TransportType, out RouteProtocolRx, out PPPoEServiceName, out RemoteIPAddress, out PPPoEACName, out DNSEnabled, out DNSOverrideAllowed);
                dConfig.Clear();
                dConfig.Add("Enable", Enable.ToString());
                dConfig.Add("ConnectionStatus", ConnectionStatus.ToString());
                dConfig.Add("PossibleConnectionTypes", PossibleConnectionTypes.ToString());
                dConfig.Add("ConnectionType", ConnectionType.ToString());
                dConfig.Add("Name", Name.ToString());
                dConfig.Add("Uptime", System.DateTime.Now.AddSeconds(Uptime).ToString());
                dConfig.Add("UpstreamMaxBitRate", UpstreamMaxBitRate.ToString());
                dConfig.Add("DownstreamMaxBitRate", DownstreamMaxBitRate.ToString());
                dConfig.Add("LastConnectionError", LastConnectionError.ToString());
                dConfig.Add("IdleDisconnectTime", IdleDisconnectTime.ToString());
                dConfig.Add("RSIPAvailable", RSIPAvailable.ToString());
                dConfig.Add("UserName", UserName.ToString());
                dConfig.Add("NATEnabled", NATEnabled.ToString());
                dConfig.Add("ExternalIPAddress", ExternalIPAddress.ToString());
                dConfig.Add("DNSServers", DNSServers.ToString());
                dConfig.Add("MACAddress", MACAddress.ToString());
                dConfig.Add("ConnectionTrigger", ConnectionTrigger.ToString());
                dConfig.Add("LastAuthErrorInfo", LastAuthErrorInfo.ToString());
                dConfig.Add("MaxCharsUsername", MaxCharsUsername.ToString());
                dConfig.Add("MinCharsUsername", MinCharsUsername.ToString());
                dConfig.Add("AllowedCharsUsername", AllowedCharsUsername.ToString());
                dConfig.Add("MaxCharsPassword", MaxCharsPassword.ToString());
                dConfig.Add("MinCharsPassword", MinCharsPassword.ToString());
                dConfig.Add("AllowedCharsPassword", AllowedCharsPassword.ToString());
                dConfig.Add("TransportType", TransportType.ToString());
                dConfig.Add("RouteProtocolRx", RouteProtocolRx.ToString());
                dConfig.Add("PPPoEServiceName", PPPoEServiceName.ToString());
                dConfig.Add("RemoteIPAddress", RemoteIPAddress.ToString());
                dConfig.Add("PPPoEACName", PPPoEACName.ToString());
                dConfig.Add("DNSEnabled", DNSEnabled.ToString());
                dConfig.Add("DNSOverrideAllowed", DNSOverrideAllowed.ToString());
                FeuerwehrCloud.Helper.AppSettings.Save(dConfig, "dyndata/wanppp.info");
            } catch (Exception ex) {
                FeuerwehrCloud.Helper.Logger.WriteLine(FeuerwehrCloud.Helper.Helper.GetExceptionDescription(ex));
            }



            System.Net.WebClient WC = new WebClient();

            FritzTR064.Generated.Tam cTam = new Tam("https://" + NetConfig["Gateway"] + ":" + NetConfig["GW-SSL-Port"]);
            cTam.SoapHttpClientProtocol.Credentials = new NetworkCredential(NetConfig["TR064-Username"], NetConfig["FRITZPass"]);
            string TamList;

            for (ushort i = 0; i < 5; i++)
            {
                ushort Index;
                bool   abEnable;
                string abName;
                bool   TAMRunning;
                ushort Stick;
                ushort Status;
                cTam.GetInfo(i, out abEnable, out abName, out TAMRunning, out Stick, out Status);
                dConfig.Clear();
                dConfig.Add("Enable", abEnable.ToString());
                dConfig.Add("Name", abName.ToString());
                dConfig.Add("TAMRunning", TAMRunning.ToString());
                dConfig.Add("Stick", Stick.ToString());
                dConfig.Add("Status", Status.ToString());
                if (abEnable == true)
                {
                    cTam.GetMessageList(i, out TamList);
                    WC.Credentials = cTam.SoapHttpClientProtocol.Credentials;
                    WC.DownloadFile(TamList, "dyndata/tam" + i.ToString() + ".xml");
                }
                FeuerwehrCloud.Helper.AppSettings.Save(dConfig, "dyndata/tam.info");
            }


            FritzTR064.Generated.Contact c = new Contact("https://" + NetConfig["Gateway"] + ":" + NetConfig["GW-SSL-Port"]);
            c.SoapHttpClientProtocol.Credentials = new NetworkCredential(NetConfig["TR064-Username"], NetConfig["FRITZPass"]);
            string calllist; string DectIDList; string HandsetName; ushort PhonebookID;  bool cEnable; string cStatus; string LastConnect; string Url; string ServiceId; string Username;

            dConfig.Clear();
            c.GetCallList(out calllist);
            WC.Credentials = c.SoapHttpClientProtocol.Credentials;
            WC.DownloadFile(calllist, "dyndata/calllist.xml");
            try {
                c.GetInfo(out cEnable, out cStatus, out LastConnect, out Url, out ServiceId, out UserName, out Name);
                dConfig.Add("Enable", cEnable.ToString());
                dConfig.Add("Status", cStatus.ToString());
                dConfig.Add("LastConnect", LastConnect.ToString());
                dConfig.Add("Url", Url.ToString());
                dConfig.Add("ServiceId", ServiceId.ToString());
                dConfig.Add("Name", Name.ToString());
                if (cEnable)
                {
                    c.GetDECTHandsetList(out DectIDList);
                    for (ushort DectID = 1; DectID < 10; DectID++)
                    {
                        c.GetDECTHandsetInfo(DectID, out HandsetName, out PhonebookID);
                        dConfig.Add("DectID", DectID.ToString());
                        dConfig.Add("HandsetName-" + DectID.ToString(), HandsetName.ToString());
                        dConfig.Add("PhonebookID-" + DectID.ToString(), PhonebookID.ToString());
                    }
                }
                //			c.GetInfoByIndex();
                //			c.GetNumberOfEntries();
                //			c.GetPhonebook();
                //			c.GetPhonebookList();
            } catch (Exception ex) {
                FeuerwehrCloud.Helper.Logger.WriteLine(FeuerwehrCloud.Helper.Helper.GetExceptionDescription(ex));
            }


            FritzTR064.Generated.Wandslifconfig1 w1 = new Wandslifconfig1("https://" + NetConfig["Gateway"] + ":" + NetConfig["GW-SSL-Port"]);
            w1.SoapHttpClientProtocol.Credentials = new NetworkCredential(NetConfig["TR064-Username"], NetConfig["FRITZPass"]);
            //FritzTR064.Generated.Wandsllinkconfig1 w2 = new Wandsllinkconfig1(());
            bool wandslIFEnable; string dslStatus; string DataPath; uint UpstreamCurrRate; uint DownstreamCurrRate; uint UpstreamMaxRate; uint DownstreamMaxRate; uint UpstreamNoiseMargin; uint DownstreamNoiseMargin; uint UpstreamAttenuation; uint DownstreamAttenuation; string ATURVendor; string ATURCountry; ushort UpstreamPower; ushort DownstreamPower;

            w1.GetInfo(out wandslIFEnable, out dslStatus, out DataPath, out UpstreamCurrRate, out DownstreamCurrRate, out UpstreamMaxRate, out DownstreamMaxRate, out UpstreamNoiseMargin, out DownstreamNoiseMargin, out UpstreamAttenuation, out DownstreamAttenuation, out ATURVendor, out ATURCountry, out UpstreamPower, out DownstreamPower);
            dConfig.Clear();
            dConfig.Add("wandslIFEnable", wandslIFEnable.ToString());
            dConfig.Add("Status", dslStatus.ToString());
            dConfig.Add("DataPath", DataPath.ToString());
            dConfig.Add("UpstreamCurrRate", UpstreamCurrRate.ToString());
            dConfig.Add("DownstreamCurrRate", DownstreamCurrRate.ToString());
            dConfig.Add("UpstreamMaxRate", UpstreamMaxRate.ToString());
            dConfig.Add("DownstreamMaxRate", DownstreamMaxRate.ToString());
            dConfig.Add("UpstreamNoiseMargin", UpstreamNoiseMargin.ToString());
            dConfig.Add("DownstreamNoiseMargin", DownstreamNoiseMargin.ToString());
            dConfig.Add("UpstreamAttenuation", UpstreamAttenuation.ToString());
            dConfig.Add("DownstreamAttenuation", DownstreamAttenuation.ToString());
            dConfig.Add("ATURVendor", ATURVendor.ToString());
            dConfig.Add("ATURCountry", ATURCountry.ToString());
            dConfig.Add("UpstreamPower", UpstreamPower.ToString());
            dConfig.Add("DownstreamPower", DownstreamPower.ToString());
            FeuerwehrCloud.Helper.AppSettings.Save(dConfig, "dyndata/wandsl.info");

            FritzTR064.Generated.Wlanconfig1 wlc = new Wlanconfig1("https://" + NetConfig["Gateway"] + ":" + NetConfig["GW-SSL-Port"]);
            wlc.SoapHttpClientProtocol.Credentials = new NetworkCredential(NetConfig["TR064-Username"], NetConfig["FRITZPass"]);
            string wlStatus; bool wlEnable; string MaxBitRate; byte Channel; string SSID; string BeaconType; bool MACAddressControlEnabled; string Standard; string BSSID; string BasicEncryptionModes; string BasicAuthenticationMode; byte MaxCharsSSID; byte MinCharsSSID; string AllowedCharsSSID; byte MinCharsPSK; byte MaxCharsPSK; string AllowedCharsPSK;

            wlc.GetInfo(out wlEnable, out wlStatus, out MaxBitRate, out Channel, out SSID, out BeaconType, out MACAddressControlEnabled, out Standard, out BSSID, out BasicEncryptionModes, out BasicAuthenticationMode, out MaxCharsSSID, out MinCharsSSID, out AllowedCharsSSID, out MinCharsPSK, out MaxCharsPSK, out AllowedCharsPSK);
            dConfig.Clear();
            dConfig.Add("Enable", wlEnable.ToString());
            dConfig.Add("Status", wlStatus.ToString());
            dConfig.Add("MaxBitRate", MaxBitRate.ToString());
            dConfig.Add("Channel", Channel.ToString());
            dConfig.Add("SSID", SSID.ToString());
            dConfig.Add("BeaconType", BeaconType.ToString());
            dConfig.Add("MACAddressControlEnabled", MACAddressControlEnabled.ToString());
            dConfig.Add("Standard", Standard.ToString());
            dConfig.Add("BSSID", BSSID.ToString());
            dConfig.Add("BasicEncryptionModes", BasicEncryptionModes.ToString());
            dConfig.Add("BasicAuthenticationMode", BasicAuthenticationMode.ToString());
            dConfig.Add("MaxCharsSSID", MaxCharsSSID.ToString());
            dConfig.Add("MinCharsSSID", MinCharsSSID.ToString());
            dConfig.Add("AllowedCharsSSID", AllowedCharsSSID.ToString());
            dConfig.Add("MinCharsPSK", MinCharsPSK.ToString());
            dConfig.Add("MaxCharsPSK", MaxCharsPSK.ToString());
            dConfig.Add("AllowedCharsPSK", AllowedCharsPSK.ToString());
            FeuerwehrCloud.Helper.AppSettings.Save(dConfig, "dyndata/wlan.info");

            FritzTR064.Generated.Voip voip1 = new Voip("https://" + NetConfig["Gateway"] + ":" + NetConfig["GW-SSL-Port"]);
            voip1.SoapHttpClientProtocol.Credentials = new NetworkCredential(NetConfig["TR064-Username"], NetConfig["FRITZPass"]);
            string NumberList; bool FaxT38Enable; string VoiceCoding; string ClientList; ushort ExistingVoIPNumbers; string PhoneName; uint NumberOfNumbers; ushort NumberOfClients; ushort MaxVoipNumbers;

            voip1.GetInfo(out FaxT38Enable, out VoiceCoding);
            voip1.GetClients(out ClientList);
            voip1.GetExistingVoIPNumbers(out ExistingVoIPNumbers);
            voip1.DialGetConfig(out PhoneName);
            voip1.GetNumbers(out NumberList);
            voip1.GetNumberOfNumbers(out NumberOfNumbers);
            voip1.GetNumberOfClients(out NumberOfClients);
            voip1.GetMaxVoIPNumbers(out MaxVoipNumbers);
            dConfig.Clear();
            dConfig.Add("NumberList", NumberList.ToString());
            dConfig.Add("FaxT38Enable", FaxT38Enable.ToString());
            dConfig.Add("VoiceCoding", VoiceCoding.ToString());
            dConfig.Add("ClientList", ClientList.ToString());
            dConfig.Add("ExistingVoIPNumbers", ExistingVoIPNumbers.ToString());
            dConfig.Add("PhoneName", PhoneName.ToString());
            dConfig.Add("NumberOfNumbers", NumberOfNumbers.ToString());
            dConfig.Add("NumberOfClients", NumberOfClients.ToString());
            dConfig.Add("MaxVoipNumbers", MaxVoipNumbers.ToString());
            FeuerwehrCloud.Helper.AppSettings.Save(dConfig, "dyndata/phone.info");

            string ManufacturerName; string ManufacturerOUI; string ModelName; string Description; string ProductClass; string SerialNumber; string SoftwareVersion; string HardwareVersion; string SpecVersion; string ProvisioningCode; uint UpTime; string DeviceLog;

            FritzTR064.Generated.Deviceinfo DevInfo = new Deviceinfo("https://" + NetConfig["Gateway"] + ":" + NetConfig["GW-SSL-Port"]);
            DevInfo.SoapHttpClientProtocol.Credentials = new NetworkCredential(NetConfig["TR064-Username"], NetConfig["FRITZPass"]);
            DevInfo.GetInfo(out ManufacturerName, out ManufacturerOUI, out ModelName, out Description, out ProductClass, out SerialNumber, out SoftwareVersion, out HardwareVersion, out SpecVersion, out ProvisioningCode, out UpTime, out DeviceLog);
            dConfig.Clear();
            dConfig.Add("ManufacturerName", ManufacturerName.ToString());
            dConfig.Add("ManufacturerOUI", ManufacturerOUI.ToString());
            dConfig.Add("ModelName", ModelName.ToString());
            dConfig.Add("Description", Description.ToString());
            dConfig.Add("ProductClass", ProductClass.ToString());
            dConfig.Add("SerialNumber", SerialNumber.ToString());
            dConfig.Add("SoftwareVersion", SoftwareVersion.ToString());
            dConfig.Add("HardwareVersion", HardwareVersion.ToString());
            dConfig.Add("SpecVersion", SpecVersion.ToString());
            dConfig.Add("ProvisioningCode", ProvisioningCode.ToString());
            dConfig.Add("UpTime", UpTime.ToString());
            dConfig.Add("DeviceLog", DeviceLog.ToString());
            FeuerwehrCloud.Helper.AppSettings.Save(dConfig, "dyndata/DeviceInfo.info");


            //FritzTR064.Generated.Contact

            //dConfig.Add("",xxxxxx.ToString());


            System.Diagnostics.Process P;

            P = new System.Diagnostics.Process()
            {
                StartInfo =
                {
                    FileName               = NetConfig ["fing"],
                    Arguments              = " -n " + NetConfig ["Gateway"] + "/24 -r 1 --session " + System.IO.Path.Combine(System.Environment.CurrentDirectory, "network.fing") + " -o table,csv," + System.IO.Path.Combine(System.Environment.CurrentDirectory, "network.csv"),
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    RedirectStandardOutput = true
                }
            };
            P.Start();
            P.WaitForExit(10000);


            P = new System.Diagnostics.Process()
            {
                StartInfo =
                {
                    FileName               = "/usr/local/bin/lsusb",
                    WorkingDirectory       = "/tmp/",
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    RedirectStandardOutput = true
                }
            };
            P.Start();
            string lsusb    = P.StandardOutput.ReadToEnd();
            int    USBCount = lsusb.Split(new [] { "\n" }, StringSplitOptions.RemoveEmptyEntries).Length;

            P.WaitForExit(10000);
            dConfig.Clear();
            dConfig.Add("Count", USBCount.ToString());
            FeuerwehrCloud.Helper.AppSettings.Save(dConfig, "dyndata/usb.info");

            P = new System.Diagnostics.Process()
            {
                StartInfo =
                {
                    FileName               = "/Users/systemiya-apple/i2cdetect.sh",
                    WorkingDirectory       = "/tmp/",
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    RedirectStandardOutput = true
                }
            };
            P.Start();
            string lsi2c = P.StandardOutput.ReadToEnd();

            P.WaitForExit(10000);
            dConfig.Clear();
            string[] i2C      = lsi2c.Split(new [] { "--" }, StringSplitOptions.RemoveEmptyEntries);
            int      I2Ccount = 116 - (i2C.Length - 2);

            dConfig.Add("Count", I2Ccount.ToString());
            FeuerwehrCloud.Helper.AppSettings.Save(dConfig, "dyndata/i2c.info");
        }
Example #20
0
    // When someone joins or leaves, do add or remove
    private void OnRoomUpdateCallback(Message <Room> message)
    {
        if (message.IsError)
        {
            Debug.LogError("Room connecton error - " + message.GetError().Message);
        }
        else
        {
            room = message.GetRoom();

            StringBuilder roomMessage = new StringBuilder("Room update - ");

            // If we are just joining the room and someone else is already there, we
            //   need to update state
            bool userNeedsStateUpdate = !userInRoom &&
                                        (room.UsersOptional.Count > 1);

            foreach (var user in room.UsersOptional)
            {
                roomMessage.Append(user.OculusID + " ");

                if (user.ID == localUser.ID)
                {
                    if (!userInRoom)
                    {
                        userInRoom = true;
                        UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "User joined room");
                    }
                }
                else
                {
                    if (!remoteConnectionStates.ContainsKey(user.ID))
                    {
                        remoteConnectionStates.Add(user.ID, new ConnectionStates()
                        {
                            username = user.OculusID
                        });
                    }

                    if (ShouldOwnConnection(user.ID))
                    {
                        UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "Initiating net and voip to " + user.ID.ToString());

                        // Network state
                        if (remoteConnectionStates[user.ID].networkState == ConnectionState.Disconnected)
                        {
                            Net.Connect(user.ID);
                            remoteConnectionStates[user.ID].networkState = ConnectionState.Connecting;
                            remoteConnectionStates[user.ID].netTimeouts  = 0;
                        }
                        else
                        {
                            UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "Skipping net connection since already connected to " + user.ID.ToString());
                        }

                        // VOIP state
                        if (remoteConnectionStates[user.ID].voipState == ConnectionState.Disconnected)
                        {
                            Voip.Start(user.ID);
                            remoteConnectionStates[user.ID].voipState    = ConnectionState.Connecting;
                            remoteConnectionStates[user.ID].voipTimeouts = 0;
                        }
                        else
                        {
                            UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "Skipping voip connection since already connected to " + user.ID.ToString());
                        }
                    }
                    else
                    {
                        UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "Skipping since don't own connection to " + user.ID.ToString());
                    }

                    // If someone was in the room before us, ask for the state
                    // once we connect.
                    if (userNeedsStateUpdate &&
                        (remoteConnectionStates[user.ID].networkState == ConnectionState.Connected))
                    {
                        OnRequestStateUpate(user.ID);
                        userNeedsStateUpdate = false;
                    }
                }
            }

            UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, roomMessage.ToString());

            if (userNeedsStateUpdate)
            {
                UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "State update request pending");
                pendingStateUpdateRequest = true;
            }
        }
    }
Example #21
0
    void OnVoipStateChangedCallback(Message <NetworkingPeer> message)
    {
        if (message.IsError)
        {
            Debug.LogError("Voip connecton error - " + message.GetError().Message);
        }
        else
        {
            NetworkingPeer peer = message.GetNetworkingPeer();

            if (!remoteConnectionStates.ContainsKey(peer.ID))
            {
                remoteConnectionStates.Add(peer.ID, new ConnectionStates());
            }

            switch (peer.State)
            {
            case PeerConnectionState.Connected:
                UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "Voip connected to " + peer.ID.ToString() +
                                                          ". State was " + remoteConnectionStates[peer.ID].voipState.ToString());

                remoteConnectionStates[peer.ID].voipState = ConnectionState.Connected;

                if (!pendingMouthAnchorAttach.Contains(peer.ID))
                {
                    pendingMouthAnchorAttach.Add(peer.ID);     // Annoyingly mouth anchor isn't populated until first update
                }
                break;

            case PeerConnectionState.Timeout:

                UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "Voip timeout for " + peer.ID.ToString() +
                                                          ". State was " + remoteConnectionStates[peer.ID].voipState.ToString());

                if (IsUserInRoom(peer.ID) && ShouldOwnConnection(peer.ID) &&
                    (remoteConnectionStates[peer.ID].voipState == ConnectionState.Connecting))
                {
                    UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info,
                                                              "Voip attempting reconnect to " + peer.ID.ToString() +
                                                              ". Attempt # " + remoteConnectionStates[peer.ID].voipTimeouts +
                                                              ". State was " + remoteConnectionStates[peer.ID].voipState.ToString());
                    Voip.Start(peer.ID);
                    remoteConnectionStates[peer.ID].voipState     = ConnectionState.Connecting;
                    remoteConnectionStates[peer.ID].voipTimeouts += 1;
                }
                else
                {
                    remoteConnectionStates[peer.ID].voipState = ConnectionState.Disconnected;
                }
                break;

            case PeerConnectionState.Closed:
                UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "Voip disconnect from " + peer.ID.ToString() +
                                                          ". State was " + remoteConnectionStates[peer.ID].voipState.ToString());

                if (IsUserInRoom(peer.ID) && ShouldOwnConnection(peer.ID) &&
                    (remoteConnectionStates[peer.ID].voipState != ConnectionState.Disconnecting))
                {
                    UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info,
                                                              "Voip attempting reconnect to " + peer.ID.ToString() +
                                                              ". Reconnect # " + remoteConnectionStates[peer.ID].voipReconnects +
                                                              ". State was " + remoteConnectionStates[peer.ID].voipState.ToString());
                    Voip.Start(peer.ID);
                    remoteConnectionStates[peer.ID].voipState       = ConnectionState.Reconnecting;
                    remoteConnectionStates[peer.ID].voipReconnects += 1;
                }
                else
                {
                    remoteConnectionStates[peer.ID].voipState = ConnectionState.Disconnected;
                }

                if (remoteAvatars.ContainsKey(peer.ID) &&
                    (remoteAvatars[peer.ID].MouthAnchor != null))
                {
                    Destroy(remoteAvatars[peer.ID].MouthAnchor.GetComponent <VoipAudioSourceHiLevel>());
                }

                pendingMouthAnchorAttach.Remove(peer.ID);

                break;

            default:
                UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Warning, "Voip unexpected state from " + peer.ID.ToString());
                Debug.LogError("Unexpected connection state");
                break;
            }
        }
    }
Example #22
0
 public VoipManager()
 {
     Voip.SetVoipConnectRequestCallback(VoipConnectRequestCallback);
     Voip.SetVoipStateChangeCallback(VoipStateChangedCallback);
 }
Example #23
0
    // Start is called before the first frame update
    void Start()
    {
        UserReportingClientConfiguration config = new UserReportingClientConfiguration(500, 300, 60, 10);

        UnityUserReporting.Configure(config);

        rightHandAnchor = GameObject.Find("RightHandAnchor");
        leftHandAnchor  = GameObject.Find("LeftHandAnchor");

        rightHandGrabber = rightHandAnchor.GetComponent <SimpleGrabber>();

        var mainDeck = GameObject.Find("MainDeck");

        deckController = mainDeck.GetComponent <DeckController>();
        deckCollider   = mainDeck.GetComponent <Collider>();

        cardHandController = leftHandAnchor.GetComponent <CardHandController>();

        Core.AsyncInitialize(appID.ToString()).OnComplete((Message <Oculus.Platform.Models.PlatformInitialize> init_message) =>
        {
            if (init_message.IsError)
            {
                Debug.LogError("Failed to initialize - " + init_message);
            }
            else
            {
                Entitlements.IsUserEntitledToApplication().OnComplete((entitlemnets_message) =>
                {
                    if (entitlemnets_message.IsError)
                    {
                        Debug.LogError("Entitlements failed - " + entitlemnets_message);
                    }
                    else
                    {
                        Users.GetLoggedInUser().OnComplete((Message <Oculus.Platform.Models.User> logged_in_user_message) =>
                        {
                            if (logged_in_user_message.IsError)
                            {
                                Debug.LogError("Could not retrieve logged in user - " + logged_in_user_message);
                            }
                            else
                            {
                                localUser = logged_in_user_message.GetUser();
                                UnityUserReporting.CurrentClient.LogEvent(UserReportEventLevel.Info, "User logged in");

                                UnityUserReporting.CurrentClient.AddDeviceMetadata("userID", localUser.ID.ToString());
                                UnityUserReporting.CurrentClient.AddDeviceMetadata("username", localUser.OculusID);

                                localAvatar = Instantiate(localAvatarPrefab);
                                localAvatar.CanOwnMicrophone = false;
                                localAvatar.UseSDKPackets    = true;
                                localAvatar.RecordPackets    = true;
                                localAvatar.PacketRecorded  += OnLocalAvatarPacketRecorded;
                                localAvatar.oculusUserID     = localUser.ID.ToString();

                                var trackingSpace = GameObject.Find("TrackingSpace");
                                localAvatar.transform.position = trackingSpace.transform.position;
                                localAvatar.transform.rotation = trackingSpace.transform.rotation;
                                localAvatar.transform.parent   = trackingSpace.transform;

                                Rooms.SetUpdateNotificationCallback(OnRoomUpdateCallback);
                                Net.SetConnectionStateChangedCallback(OnConnectionStateChangedCallback);
                                Net.SetPeerConnectRequestCallback(OnConnectRequestCallback);
                                Net.SetPingResultNotificationCallback(OnPingResultCallback);
                                Voip.SetVoipConnectRequestCallback(OnVoipConnectRequestCallback);
                                Voip.SetVoipStateChangeCallback(OnVoipStateChangedCallback);

                                // NOTE - Setting this before the platform is initialized does NOT WORK!!
                                Voip.SetMicrophoneFilterCallback(MicrophoneFilterCallback);

                                Rooms.Join(roomID, true).OnComplete(OnRoomUpdateCallback);

#if PLATFORM_ANDROID
                                if (!Permission.HasUserAuthorizedPermission(Permission.Microphone))
                                {
                                    Permission.RequestUserPermission(Permission.Microphone);
                                }

                                UnityUserReporting.CurrentClient.AddDeviceMetadata("Microphone Enabled",
                                                                                   Permission.HasUserAuthorizedPermission(Permission.Microphone).ToString());
#endif
                            }
                        });
                    }
                });
            }
        });
    }
Example #24
0
    void GetLoggedInUserCallback(Message <User> msg)
    {
        if (msg.IsError)
        {
            TerminateWithError(msg);
            return;
        }

        myID       = msg.Data.ID;
        myOculusID = msg.Data.OculusID;

        localAvatar        = Instantiate(localAvatarPrefab);
        localTrackingSpace = this.transform.Find("OVRCameraRig/TrackingSpace").gameObject;

        localAvatar.transform.SetParent(localTrackingSpace.transform, false);
        localAvatar.transform.localPosition = new Vector3(0, 0, 0);
        localAvatar.transform.localRotation = Quaternion.identity;

        if (UnityEngine.Application.platform == RuntimePlatform.Android)
        {
            helpPanel.transform.SetParent(localAvatar.transform.Find("body"), false);
            helpPanel.transform.localPosition = new Vector3(0, 0.0f, 1.0f);
            helpMesh.material = gearMaterial;
        }
        else
        {
            helpPanel.transform.SetParent(localAvatar.transform.Find("hand_left"), false);
            helpPanel.transform.localPosition = new Vector3(0, 0.2f, 0.2f);
            helpMesh.material = riftMaterial;
        }

        localAvatar.oculusUserID    = myID.ToString();
        localAvatar.RecordPackets   = true;
        localAvatar.PacketRecorded += OnLocalAvatarPacketRecorded;

        Quaternion rotation = Quaternion.identity;

        switch (UnityEngine.Random.Range(0, 4))
        {
        case 0:
            rotation.eulerAngles         = START_ROTATION_ONE;
            this.transform.localPosition = START_POSITION_ONE;
            this.transform.localRotation = rotation;
            break;

        case 1:
            rotation.eulerAngles         = START_ROTATION_TWO;
            this.transform.localPosition = START_POSITION_TWO;
            this.transform.localRotation = rotation;
            break;

        case 2:
            rotation.eulerAngles         = START_ROTATION_THREE;
            this.transform.localPosition = START_POSITION_THREE;
            this.transform.localRotation = rotation;
            break;

        case 3:
        default:
            rotation.eulerAngles         = START_ROTATION_FOUR;
            this.transform.localPosition = START_POSITION_FOUR;
            this.transform.localRotation = rotation;
            break;
        }

        TransitionToState(State.CHECKING_LAUNCH_STATE);

        // If the user launched the app by accepting the notification, then we want to
        // join that room.  If not we need to create a room to join
        if (!roomManager.CheckForInvite())
        {
            roomManager.CreateRoom();
            TransitionToState(State.CREATING_A_ROOM);
        }
        Voip.SetMicrophoneFilterCallback(micFilterDelegate);
    }