Esempio n. 1
0
        /// <summary>
        /// Create a new Bluetooth controller object with characteristics for directional control.
        /// </summary>
        /// <param name="_device">Hardware device the system is running on.</param>
        public BluetoothController(F7Micro _device)
        {
            Forward = new CharacteristicBool(
                "Forward",
                uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300aa",
                permissions: CharacteristicPermission.Write | CharacteristicPermission.Read,
                properties: CharacteristicProperty.Write | CharacteristicProperty.Read
                );
            Reverse = new CharacteristicBool(
                "Reverse",
                uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300bb",
                permissions: CharacteristicPermission.Write | CharacteristicPermission.Read,
                properties: CharacteristicProperty.Write | CharacteristicProperty.Read
                );
            Left = new CharacteristicBool(
                "Left",
                uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300cc",
                permissions: CharacteristicPermission.Write | CharacteristicPermission.Read,
                properties: CharacteristicProperty.Write | CharacteristicProperty.Read
                );
            Right = new CharacteristicBool(
                "Right",
                uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300dd",
                permissions: CharacteristicPermission.Write | CharacteristicPermission.Read,
                properties: CharacteristicProperty.Write | CharacteristicProperty.Read
                );

            var service = new Service(name: "DirectionalControl", uuid: 253, Forward, Reverse, Left, Right);

            BleTreeDefinition = new Definition("Mars Rover", service);
            _device.BluetoothAdapter.StartBluetoothServer(BleTreeDefinition);
        }
Esempio n. 2
0
        Definition GetDefinition()
        {
            up = new CharacteristicBool(
                "Up",
                uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300aa",
                permissions: CharacteristicPermission.Write | CharacteristicPermission.Read,
                properties: CharacteristicProperty.Write | CharacteristicProperty.Read
                );
            down = new CharacteristicBool(
                "Down",
                uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300bb",
                permissions: CharacteristicPermission.Write | CharacteristicPermission.Read,
                properties: CharacteristicProperty.Write | CharacteristicProperty.Read
                );
            left = new CharacteristicBool(
                "Left",
                uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300cc",
                permissions: CharacteristicPermission.Write | CharacteristicPermission.Read,
                properties: CharacteristicProperty.Write | CharacteristicProperty.Read
                );
            right = new CharacteristicBool(
                "Right",
                uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300dd",
                permissions: CharacteristicPermission.Write | CharacteristicPermission.Read,
                properties: CharacteristicProperty.Write | CharacteristicProperty.Read
                );

            var service = new Service(
                name: "ServiceA",
                uuid: 253,
                up, down, left, right
                );

            return(new Definition("MeadowRover", service));
        }
Esempio n. 3
0
        protected Definition GetDefinition()
        {
            onOffCharacteristic = new CharacteristicBool(
                "On_Off",
                Guid.NewGuid().ToString(),
                CharacteristicPermission.Read | CharacteristicPermission.Write,
                CharacteristicProperty.Read | CharacteristicProperty.Write);

            var service = new Service(
                "ServiceA",
                253,
                onOffCharacteristic,

                new CharacteristicBool(
                    "My Bool",
                    uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300aa",
                    permissions: CharacteristicPermission.Read,
                    properties: CharacteristicProperty.Read
                    ),

                new CharacteristicInt32(
                    "My Number",
                    uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300bb",
                    permissions: CharacteristicPermission.Write | CharacteristicPermission.Read,
                    properties: CharacteristicProperty.Write | CharacteristicProperty.Read
                    ),

                new CharacteristicString(
                    "My Text",
                    uuid: "017e99d6-8a61-11eb-8dcd-0242ac1300cc",
                    maxLength: 20,
                    permissions: CharacteristicPermission.Write | CharacteristicPermission.Read,
                    properties: CharacteristicProperty.Write | CharacteristicProperty.Read
                    )
                );

            return(new Definition("MY MEADOW F7", service));
        }
        Definition GetDefinition()
        {
            isOnCharacteristic = new CharacteristicBool(
                name: "On_Off",
                uuid: IS_ON,
                permissions: CharacteristicPermission.Read | CharacteristicPermission.Write,
                properties: CharacteristicProperty.Read | CharacteristicProperty.Write);

            colorCharacteristic = new CharacteristicInt32(
                name: "CurrentColor",
                uuid: COLOR,
                permissions: CharacteristicPermission.Read | CharacteristicPermission.Write,
                properties: CharacteristicProperty.Read | CharacteristicProperty.Write);

            var service = new Service(
                name: "ServiceA",
                uuid: 253,
                isOnCharacteristic,
                colorCharacteristic
                );

            return(new Definition("MeadowRGB", service));
        }