Ejemplo n.º 1
0
 private void RestorePlayerPrefs()
 {
     if (PlayerPrefs.HasKey("Type"))
     {
         bt_Type = (BeaconType)PlayerPrefs.GetInt("Type");
     }
     if (PlayerPrefs.HasKey("Region"))
     {
         s_Region = PlayerPrefs.GetString("Region");
     }
     if (PlayerPrefs.HasKey("UUID"))
     {
         s_UUID = PlayerPrefs.GetString("UUID");
     }
     if (PlayerPrefs.HasKey("Major"))
     {
         s_Major = PlayerPrefs.GetString("Major");
     }
     if (PlayerPrefs.HasKey("Minor"))
     {
         s_Minor = PlayerPrefs.GetString("Minor");
     }
     if (PlayerPrefs.HasKey("BroadcastMode"))
     {
         bm_Mode = (BroadcastMode)PlayerPrefs.GetInt("BroadcastMode");
     }
     else
     {
         bm_Mode = BroadcastMode.unknown;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TodoListPage"/> class.
        /// </summary>
        /// <param name="sharedBeaconItem">
        /// The shared beacon item.
        /// </param>
        /// <param name="beaconType">
        /// The beacon type.
        /// </param>
        public TodoListPage(SharedBeacon sharedBeaconItem, BeaconType beaconType)
        {
            Button button1 = new Button
            {
                Text = "1. Save Position",
                Font = Font.SystemFontOfSize(NamedSize.Large),
                BorderWidth = 0
            };

            button1.Clicked += (sender, args) =>
            {
                sharedBeaconItem.PosX = GlobalSharedBeaconCollection.PosX;
                sharedBeaconItem.PosY = GlobalSharedBeaconCollection.PosY;

                if (beaconType == BeaconType.AccessPoint)
                {
                    GlobalSharedBeaconCollection.currentAccessPoint.Add(sharedBeaconItem);

                    ProxyServiceAgent.SetAccessPoint(sharedBeaconItem);
                }
                else if (beaconType == BeaconType.MeasurePoint)
                {
                    GlobalSharedBeaconCollection.currentMeasurePoint.Add(sharedBeaconItem);

                    List<SharedBeacon> list = new List<SharedBeacon>(GlobalSharedBeaconCollection.observableItems);

                    ProxyServiceAgent.SetMeasurePoint(
                        list,
                        new System.Drawing.Point(
                            (int)GlobalSharedBeaconCollection.PosX,
                            (int)GlobalSharedBeaconCollection.PosY));
                }

                GlobalSharedBeaconCollection.PosX = 0;
                GlobalSharedBeaconCollection.PosY = 0;

                Navigation.PopAsync();
            };

            if (beaconType == BeaconType.StartProcess)
            {
                button1.IsEnabled = false;
            }

            var parent = new StackLayout();
            parent.Children.Add(button1);
            parent.Children.Add(new ShapeView(sharedBeaconItem)
            {
                   BeaconType = beaconType
            });

            parent.BackgroundColor = Color.White;
            parent.VerticalOptions = LayoutOptions.Fill;
            parent.Orientation = StackOrientation.Vertical;
            parent.Spacing = 0;

            this.Content = parent;
            this.Title = "Beacon Map";
        }
Ejemplo n.º 3
0
 public Beacon(BeaconType _type)
     : this(_type, "", 0, 0, "", BeaconRange.UNKNOWN, 127, -1, 127)
 {
     if (_type != BeaconType.Any && _type != BeaconType.EddystoneEID)
     {
         throw new ArgumentException("Only BeaconType.Any or BeaconType.EddystoneEID is allowed in this overloaded constructor.");
     }
 }
Ejemplo n.º 4
0
 public async Task <IActionResult> Patch([FromBody] BeaconType beaconType)
 {
     if (beaconType != null)
     {
         return(Ok(await beaconType.Update()));
     }
     return(BadRequest("Parameters are null"));
 }
Ejemplo n.º 5
0
    private void setBeaconPropertiesAtStart()
    {
        //RestorePlayerPrefs();
        if (bm_Mode == BroadcastMode.unknown)           // first start
        {
            bm_Mode = BroadcastMode.receive;
            bt_Type = BeaconType.iBeacon;
            if (iBeaconServer.region.regionName != "")
            {
                Debug.Log("check iBeaconServer-inspector");
                s_Region = iBeaconServer.region.regionName;
                bt_Type  = iBeaconServer.region.beacon.type;
                if (bt_Type == BeaconType.EddystoneURL)
                {
                    s_UUID = iBeaconServer.region.beacon.UUID;
                }
                else if (bt_Type == BeaconType.EddystoneUID)
                {
                    s_UUID  = iBeaconServer.region.beacon.UUID;
                    s_Major = iBeaconServer.region.beacon.instance;
                }
                else if (bt_Type == BeaconType.iBeacon)
                {
                    s_UUID  = iBeaconServer.region.beacon.UUID;
                    s_Major = iBeaconServer.region.beacon.major.ToString();
                    s_Minor = iBeaconServer.region.beacon.minor.ToString();
                }
            }
            else if (iBeaconReceiver.regions.Length != 0)
            {
                Debug.Log("check iBeaconReceiver-inspector");
                s_Region = iBeaconReceiver.regions[0].regionName;
                bt_Type  = iBeaconReceiver.regions[0].beacon.type;
                if (bt_Type == BeaconType.EddystoneURL)
                {
                    s_UUID = iBeaconReceiver.regions[0].beacon.UUID;
                }
                else if (bt_Type == BeaconType.EddystoneUID)
                {
                    s_UUID  = iBeaconReceiver.regions[0].beacon.UUID;
                    s_Major = iBeaconReceiver.regions[0].beacon.instance;
                }
                else if (bt_Type == BeaconType.iBeacon)
                {
                    s_UUID  = iBeaconReceiver.regions[0].beacon.UUID;
                    s_Major = iBeaconReceiver.regions[0].beacon.major.ToString();
                    s_Minor = iBeaconReceiver.regions[0].beacon.minor.ToString();
                }
            }
        }

        InputDropdown.value = (int)bt_Type;
        bs_State            = BroadcastState.inactive;
        SetBeaconProperties();
        SetBroadcastMode();
        SetBroadcastState();
        Debug.Log("Beacon properties and modes restored");
    }
        public static IBeacon Select(BeaconType type)
        {
            switch (type)
            {
            case BeaconType.BeerBeacon:
                return(new Beacon());

            default:
                return(new Beacon());
            }
        }
Ejemplo n.º 7
0
    private Beacon(BeaconType _type, string _uuid, int _major, int _minor, string _instance, BeaconRange _range, int _strength, double _accuracy, int _rssi)
    {
        this._type     = _type;
        this._UUID     = _uuid;
        this._major    = _major;
        this._minor    = _minor;
        this._instance = _instance;
        this._range    = _range;
        this._strength = _strength;
        this._accuracy = _accuracy;
        this._lastSeen = DateTime.Now;
        this._rssi     = _rssi;

        if (_type == BeaconType.EddystoneUID)
        {
            Match namespaceMatch = EddystoneNamespaceRegex.Match(this._UUID);
            if (!namespaceMatch.Success)
            {
                throw new ArgumentException("Value does not fit to the Eddystone UID Namespace format.", "_namespace");
            }
            this._UUID = new StringBuilder("0x", 22).Append('0', 20 - namespaceMatch.Groups[1].Value.Length).Append(namespaceMatch.Groups[1].Value).ToString();

            if (!String.IsNullOrEmpty(this._instance))
            {
                Match instanceMatch = EddystoneInstanceRegex.Match(this._instance);
                if (!instanceMatch.Success)
                {
                    throw new ArgumentException("Value does not fit to the Eddystone UID Instance format.", "_instance");
                }
                this._instance = new StringBuilder("0x", 14).Append('0', 12 - instanceMatch.Groups[1].Value.Length).Append(instanceMatch.Groups[1].Value).ToString();
                if (this._instance == "0x000000000000")
                {
                    this._instance = "";
                }
            }
        }
        else if (_type == BeaconType.iBeacon)
        {
            if (!iBeaconUUIDRegex.IsMatch(this._UUID))
            {
                throw new ArgumentException("Value does not fit to the iBeacon UUID format.", "_namespace");
            }
        }

        if (this._UUID != null)
        {
            this._UUID = this._UUID.ToLower();
        }
        if (this._instance != null)
        {
            this._instance = this._instance.ToLower();
        }
    }
Ejemplo n.º 8
0
        public static Guid ToGuid(this BeaconType self)
        {
            switch (self)
            {
            case BeaconType.Eddystone: return(_eddystoneGuid);

            case BeaconType.AXABeacon: return(_axaBeacon);

            case BeaconType.iBeacon:
            case BeaconType.Unknown:
            default: return(Guid.Empty);
            }
        }
Ejemplo n.º 9
0
 private Beacon(BeaconType _type, string _uuid, int _major, int _minor, string _instance, BeaconRange _range, int _strength, double _accuracy, int _rssi)
 {
     this._type     = _type;
     this._UUID     = _uuid;
     this._major    = _major;
     this._minor    = _minor;
     this._instance = _instance;
     this._range    = _range;
     this._strength = _strength;
     this._accuracy = _accuracy;
     this._lastSeen = DateTime.Now;
     this._rssi     = _rssi;
 }
Ejemplo n.º 10
0
    private void setBeaconPropertiesAtStart()
    {
        RestorePlayerPrefs();                                   //載入前次紀錄
        //----------------------------------------------------------------------------------------------------
        s_Region = ck_Region;                                   //讀入設定的區域名
        ck_UUID  = ck_UUID.ToLower();
        s_UUID   = ck_UUID;                                     //讀入設定的UUID
        bm_Mode  = BroadcastMode.receive;                       //廣播模式設定為接收
        bt_Type  = BeaconType.Any;                              //Beacon模式設定為所有類型
        bs_State = BroadcastState.inactive;                     //將廣播狀態設為未啟動
        //----------------------------------------------------------------------------------------------------
        // 若iBeaconServer或Receiver有設定,就優先讀取(目前未使用)

        /*if (bm_Mode == BroadcastMode.unknown) { // first start
         *      bm_Mode = BroadcastMode.receive;
         *      bt_Type = BeaconType.iBeacon;
         *      if (iBeaconServer.region.regionName != "") {
         *              Debug.Log("check iBeaconServer-inspector");
         *              s_Region = iBeaconServer.region.regionName;
         *              bt_Type     = iBeaconServer.region.beacon.type;
         *              if (bt_Type == BeaconType.EddystoneURL) {
         *                      s_UUID = iBeaconServer.region.beacon.UUID;
         *              } else if (bt_Type == BeaconType.EddystoneUID) {
         *                      s_UUID = iBeaconServer.region.beacon.UUID;
         *                      s_Major = iBeaconServer.region.beacon.instance;
         *              } else if (bt_Type == BeaconType.iBeacon) {
         *                      s_UUID = iBeaconServer.region.beacon.UUID;
         *                      s_Major = iBeaconServer.region.beacon.major.ToString();
         *                      s_Minor = iBeaconServer.region.beacon.minor.ToString();
         *              }
         *      } else if (iBeaconReceiver.regions.Length != 0) {
         *              Debug.Log("check iBeaconReceiver-inspector");
         *              s_Region	= iBeaconReceiver.regions[0].regionName;
         *              bt_Type     = iBeaconReceiver.regions[0].beacon.type;
         *              if (bt_Type == BeaconType.EddystoneURL) {
         *                      s_UUID = iBeaconReceiver.regions[0].beacon.UUID;
         *              } else if (bt_Type == BeaconType.EddystoneUID) {
         *                      s_UUID = iBeaconReceiver.regions[0].beacon.UUID;
         *                      s_Major = iBeaconReceiver.regions[0].beacon.instance;
         *              } else if (bt_Type == BeaconType.iBeacon) {
         *                      s_UUID = iBeaconReceiver.regions[0].beacon.UUID;
         *                      s_Major = iBeaconReceiver.regions[0].beacon.major.ToString();
         *                      s_Minor = iBeaconReceiver.regions[0].beacon.minor.ToString();
         *              }
         *      }
         * }
         * bs_State = BroadcastState.inactive;*/
    }
Ejemplo n.º 11
0
 public void dd_onBeaconTypeChanged(Dropdown target)
 {
     bt_PendingType = (BeaconType)target.value;
     if (bt_PendingType == BeaconType.iBeacon)
     {
         set_iBeaconText();
     }
     else if (bt_PendingType == BeaconType.EddystoneUID)
     {
         set_EddyUIDText();
     }
     else if (bt_PendingType == BeaconType.EddystoneURL)
     {
         set_EddyUrlText();
     }
     else             // any
     {
         set_AnyText();
     }
 }
Ejemplo n.º 12
0
 // Beacon Properties
 public void btn_changeUUID()       // onRelease
 // Beaconregion
 {
     if (input_Region.text != null && input_Region.text != "")
     {
         s_Region = input_Region.text;
     }
     // Beacontype
     bt_Type = bt_PendingType;
     // UUID, Namespace, Url
     if (input_UUID.text != null && input_UUID.text != "")
     {
         s_UUID = input_UUID.text;
     }
     // Major or Instance on send
     if (input_Major.text != null && input_Major.text != "")
     {
         s_Major = input_Major.text;
     }
     // Minor on send
     if (input_Minor.text != null && input_Minor.text != "")
     {
         s_Minor = input_Minor.text;
     }
     input_Region.image.color  = Color.white;
     input_Region.text         = "";
     input_UUID.image.color    = Color.white;
     input_UUID.text           = "";
     input_Major.image.color   = Color.white;
     input_Major.text          = "";
     input_Minor.image.color   = Color.white;
     input_Minor.text          = "";
     InputDropdown.image.color = Color.white;
     SetBeaconProperties();
     //SavePlayerPrefs();
 }
Ejemplo n.º 13
0
        public Beacon(string id, Beacon.BeaconType beacon_type)
        {
            Id = id;

            beaconType = beacon_type;
        }
Ejemplo n.º 14
0
 public Beacon(string hwid, BeaconType type, string dm)
 {
     Hwid = hwid;
     Type = type;
     Dm   = dm;
 }
Ejemplo n.º 15
0
    private bool GetBeaconPropertyAttributeResult(BeaconPropertyAttribute beaconAttribute, SerializedProperty property, out BeaconType type)
    {
        var sb = new StringBuilder(property.propertyPath);
        var i  = property.propertyPath.LastIndexOf('.') + 1;

        sb.Remove(i, property.propertyPath.Length - i);
        sb.Append("_type");
        type = (BeaconType)property.serializedObject.FindProperty(sb.ToString()).enumValueIndex;
        return(ArrayUtility.Contains <BeaconType>(beaconAttribute.Types, type) ^ beaconAttribute.Exclude);
    }
 public BeaconId(BeaconType beaconType, byte[] beaconId)
 {
     this.Type = beaconType;
     this.Id   = beaconId;
     this.Base64Representation = Convert.ToBase64String(beaconId);
 }
Ejemplo n.º 17
0
 public BeaconEvent(WebhookEventSource source, long timestamp, string replyToken, string hwid, BeaconType beaconType, string dm, string mode, string webhookEventId, DeliveryContext deliveryContext)
     : base(WebhookEventType.Beacon, source, timestamp, replyToken, mode, webhookEventId, deliveryContext)
 {
     Beacon = new Beacon(hwid, beaconType, dm);
 }
Ejemplo n.º 18
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");
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Manually create a new Beacon instance.
 /// </summary>
 /// <param name="beaconType">Beacon type to use for this manually constructed beacon.</param>
 public Beacon(BeaconType beaconType)
 {
     BeaconType = beaconType;
 }
Ejemplo n.º 20
0
        private void HandleShapeDraw(Canvas canvas, float x, float y, string text, BeaconType beaconType)
        {
            //case ShapeType.Box:
            //    HandleStandardDraw (canvas, p => {
            //        var rect = new RectF (x, y, x + this.Width, y + this.Height);
            //        if (ShapeView.CornerRadius > 0) {
            //            var cr = Resize (ShapeView.CornerRadius);
            //            canvas.DrawRoundRect (rect, cr, cr, p);
            //        } else {
            //            canvas.DrawRect (rect, p);
            //        }
            //    });
            //    break;
            // case ShapeType.Circle:

            int radius = beaconType == BeaconType.StartProcess ? 45 : 20;

            this.HandleStandardDraw(canvas, p => canvas.DrawCircle(x, y, radius, p), beaconType);
            this.HandleStandardDraw(canvas, p => { p.TextSize = 50; canvas.DrawText(text, x, y + 40, p); }, beaconType);
        }
Ejemplo n.º 21
0
 public BeaconEvent(WebhookEventSource source, long timestamp, string replyToken, string hwid, BeaconType beaconType, string dm)
     : base(WebhookEventType.Beacon, source, timestamp, replyToken)
 {
     Beacon = new Beacon(hwid, beaconType, dm);
 }
Ejemplo n.º 22
0
        /// <summary>
        /// A simple method that handles drawing our shape with the various colours we need
        /// </summary>
        /// <param name="canvas">
        /// Canvas.
        /// </param>
        /// <param name="drawShape">
        /// Draw shape.
        /// </param>
        /// <param name="beaconType">
        /// The beacon Type.
        /// </param>
        private void HandleStandardDraw(Canvas canvas, Action<Paint> drawShape, BeaconType beaconType)
        {
            var strokePaint = new Paint(PaintFlags.AntiAlias);
            strokePaint.SetStyle(Paint.Style.FillAndStroke);

            strokePaint.StrokeCap = Paint.Cap.Round;
            strokePaint.Color = beaconType == BeaconType.MeasurePoint ? Color.Yellow : Color.Black;

            drawShape(strokePaint);
        }
Ejemplo n.º 23
0
    private void StartStates()
    {
        s_Region = ck_Region;                           //讀入設定的區域名
        ck_UUID  = ck_UUID.ToLower();
        s_UUID   = ck_UUID;                             //讀入設定的UUID
        bm_Mode  = BroadcastMode.receive;               //廣播模式設定為接收
        bt_Type  = BeaconType.Any;                      //Beacon模式設定為任意模式
        bs_State = BroadcastState.inactive;             //將廣播狀態設為未啟動

        ck_Minor1 = 1001;
        ck_Minor2 = 1002;
        ck_Minor3 = 1003;
        ck_Minor4 = 1004;

        /*ck_Minor1 = 22720;
        *  ck_Minor2 = 31168;
        *  ck_Minor3 = 64703;
        *  ck_Minor4 = 59583;*/
        myStr1  = -65;
        myStr2  = -62;
        myStr3  = -57;
        myStr4  = -59;
        envfac  = 2.0;
        sheight = 2.0;
        lheight = 0.5;
        pos12   = 4.4;
        pos23   = 9.6;
        tps     = 1.1f;

        /*if(_B1minor.text != "")
         *      ck_Minor1 = Convert.ToInt32(_B1minor.text);
         * if(_B2minor.text != "")
         *      ck_Minor2 = Convert.ToInt32(_B2minor.text);
         * if(_B3minor.text != "")
         *      ck_Minor3 = Convert.ToInt32(_B3minor.text);
         * if(_B4minor.text != "")
         *      ck_Minor4 = Convert.ToInt32(_B4minor.text);
         * if(_IFB1str.text != "")
         *      myStr1 = Convert.ToInt32(_IFB1str.text);
         * if(_IFB2str.text != "")
         *      myStr2 = Convert.ToInt32(_IFB2str.text);
         * if(_IFB3str.text != "")
         *      myStr3 = Convert.ToInt32(_IFB3str.text);
         * if(_IFB4str.text != "")
         *      myStr4 = Convert.ToInt32(_IFB4str.text);
         * if(_IFEV.text != "")
         *      envfac = Convert.ToDouble(_IFEV.text);
         * if(_IFHT.text != "")
         *      sheight = Convert.ToDouble(_IFHT.text);
         * if(_POS12.text != "")
         *      pos12 = Convert.ToDouble(_POS12.text);
         * else
         *      pos12 = 0.0;
         * if(_POS23.text != "")
         *      pos23 = Convert.ToDouble(_POS23.text);
         * else
         *      pos23 = 0.0;*/
        /*if(_POS34.text != "")
         * pos34 = Convert.ToDouble(_POS34.text);
         * else
         *      pos34 = 0.0;
         * if(_POS14.text != "")
         *      pos14 = Convert.ToDouble(_POS14.text);
         * else
         *      pos14 = 0.0;*/
        //四顆版面積
        //HF_area = pos12 * pos23;
    }
Ejemplo n.º 24
0
 public BeaconID(BeaconType type, byte[] id)
 {
     _beaconType = type;
     _beaconID   = id;
 }