Exemplo n.º 1
0
        private DatapointDefinition[] ConstructDatapoints(out DatapointDefinition boolDatapoint)
        {
            var datapoints = new List <DatapointDefinition>();

            boolDatapoint = new SgetDatapointDefinition(new Guid("{83f02bea-c22b-46aa-b1c2-4ab8102d8a80}"), UicUriBuilder.DatapointFrom(this, "Bool_mock"), UicDataType.Bool, "Random Bool", "Digital input mockup");
            datapoints.Add(boolDatapoint);
            datapoints.Add(new SgetDatapointDefinition(new Guid("{4087d40d-d4e2-42b1-89a4-9b9d18499a04}"), UicUriBuilder.DatapointFrom(this, "Integer_mock"), UicDataType.Integer, "Random Integer", "Integer measurement mockup"));
            datapoints.Add(new SgetDatapointDefinition(new Guid("{a41fc3af-4f73-42bf-8290-43ed883edd8f}"), UicUriBuilder.DatapointFrom(this, "Double_mock"), UicDataType.Double, "Random Double", "Double measurement mockup"));
            datapoints.Add(new SgetDatapointDefinition(new Guid("{3b20829f-cc30-4923-a2d6-30502ccb9acd}"), UicUriBuilder.DatapointFrom(this, "Gps_mock"), UicDataType.Gps, "Random GPS", "geo location mockup"));
            datapoints.Add(new SgetDatapointDefinition(new Guid("{fbd3e390-ffb7-455b-b0dc-695b13329eb6}"), UicUriBuilder.DatapointFrom(this, "String_mock"), UicDataType.String, "Random String", "messaging mockup"));

            return(datapoints.ToArray());
        }
Exemplo n.º 2
0
        private List <DatapointDefinition> GetDatapointDefinitions()
        {
            List <DatapointDefinition> list = new List <DatapointDefinition>();

            foreach (BoardInformationValueId item in Enum.GetValues(typeof(BoardInformationValueId)))
            {
                SgetDatapointDefinition datapointDefinition = GetDatapointDefinitionOf(item);
                if (datapointDefinition != null)
                {
                    _boardValueDic.Add(datapointDefinition.Id, item);
                    list.Add(datapointDefinition);
                }
            }
            return(list);
        }
Exemplo n.º 3
0
        private EdmCapability CreateEdmCapability()
        {
            var dataPoints = new List <DatapointDefinition>();
            var commands   = new List <CommandDefinition>();

            foreach (EapiGpioId pin in Enum.GetValues(typeof(EapiGpioId)))
            {
                string pinname = "Pin" + (int)pin;
                string uri     = UicUriBuilder.DatapointFrom(this, pinname);
                _gpioIdMap[uri] = pin;

                var pinDef = new SgetDatapointDefinition(pin.ToGuid(), uri, UicDataType.Bool, pinname, string.Empty);
                dataPoints.Add(pinDef);


                if ((int)pin > (int)EapiGpioId.EAPI_ID_GPIO_GPIO07)
                {
                    var onCommand = new SgetCommandDefinition(
                        pin.ToOnCommandGuid(),
                        UicUriBuilder.CommandFrom(this, pinname + ".on"),
                        "Set " + pinname,
                        pinname + "@set",
                        UicDataType.Bool,
                        string.Empty,
                        pinDef
                        , new[] { "On" });
                    commands.Add(onCommand);
                    _onCommandMap.Add(onCommand.Uri, pin);
                    var offCommand = new SgetCommandDefinition(
                        pin.ToOffCommandGuid(),
                        UicUriBuilder.CommandFrom(this, pinname + ".off"),
                        "Reset " + pinname,
                        pinname + "@reset",
                        UicDataType.Bool,
                        string.Empty,
                        pinDef
                        , new[] { "Off" });
                    commands.Add(offCommand);
                    _offCommandMap.Add(offCommand.Uri, pin);
                }
            }

            return(new GpioEdmCapability(Identifier, dataPoints.ToArray(), new AttributeDefinition[0], commands.ToArray()));
        }