示例#1
0
        /*
         * 0x24	36	0xAA02	IR Temperature Config
         * 0x2C	44	0xAA22	Humidity Config
         * 0x34	52	0xAA42	Barometer Configuration
         * 0x3C	60	0xAA82	Movement Config
         * 0x44	68	0xAA72	Luxometer Config
         */
        private void btnSTEnableNotify_Click(object sender, EventArgs e)
        {
            byte[] cmd;

            cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 58, new byte[] { 0x00, 0x00 });
            bglib.SendCommand(cmd);

            cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 60, new byte[] { 0x00, 0x00 });
            bglib.SendCommand(cmd);

            cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 62, new byte[] { 0x14 });
            bglib.SendCommand(cmd);

            Thread.Sleep(1000);

            if (cbxMotionOnly.Checked)
            {
                cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 60, new byte[] { 0x3f, 0x00 });
                bglib.SendCommand(cmd);
            }
            else
            {
                cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 36, new byte[] { 0x01 });
                bglib.SendCommand(cmd);

                cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 44, new byte[] { 0x01 });
                bglib.SendCommand(cmd);

                cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 52, new byte[] { 0x01 });
                bglib.SendCommand(cmd);

                cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 68, new byte[] { 0x01 });
                bglib.SendCommand(cmd);
            }
            Thread.Sleep(1000);

            if (cbxMotionOnly.Checked)
            {
                cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 58, new byte[] { 0x01, 0x00 });
                bglib.SendCommand(cmd);
            }
            else
            {
                cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 34, new byte[] { 0x01, 0x00 });
                bglib.SendCommand(cmd);

                cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 42, new byte[] { 0x01, 0x00 });
                bglib.SendCommand(cmd);

                cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 50, new byte[] { 0x01, 0x00 });
                bglib.SendCommand(cmd);



                cmd = bglib.BLECommandATTClientWriteCommand(adrTIUser, 66, new byte[] { 0x01, 0x00 });
                bglib.SendCommand(cmd);
            }

            app_state = STATE_LISTENING_MEASUREMENTS;
        }