public static CodeArgument CreateFrom(DeviceProperty deviceProperty)
        {
            var codeArgument = new CodeArgument
            {
                Name       = Helpers.ToCamelCase(Helpers.ReplaceIllegals(deviceProperty.Name)),
                Type       = Helpers.DataTypeToString(deviceProperty.Type),
                EndpointID = deviceProperty.ID
            };

            return(codeArgument);
        }
Exemple #2
0
        public static CodeFunction CreateFrom(DeviceFunction deviceFunction)
        {
            var codeFunction = new CodeFunction
            {
                Name       = Helpers.ToPascalCase(Helpers.ReplaceIllegals(deviceFunction.Name)),
                EndpointID = deviceFunction.ID.ToString()
            };

            var arguments = deviceFunction.Arguments.Concat(deviceFunction.Inputs).ToList();

            codeFunction.Arguments = arguments.Select(argument => CodeArgument.CreateFrom(argument)).ToList();

            if (deviceFunction.Outputs.Any())
            {
                codeFunction.ReturnType = Helpers.DataTypeToString(deviceFunction.Outputs.First().Type);
            }

            return(codeFunction);
        }