예제 #1
0
        private void PlayInformationSound()
        {
            Int32  ret  = 0;
            String disp = "";



            LibDef.BT_BUZZER_PARAM stBuzzerSet = new LibDef.BT_BUZZER_PARAM(); // Buzzer control structure (Set)
            // Set to repeat "500 ms on, 500 ms off" 3 times
            stBuzzerSet.dwOn    = 100;                                         // Rumble time [ms] (1 to 5000)
            stBuzzerSet.dwOff   = 100;                                         // Stop time [ms] (0 to 5000)
            stBuzzerSet.dwCount = 1;                                           // Rumble count [times] (0 to 100)
            stBuzzerSet.bTone   = 16;                                          //16;		// Musical scale (1 to 16)
            stBuzzerSet.bVolume = 3;                                           // Buzzer volume (1 to 3)

            //LibDef.BT_VIBRATOR_PARAM stVibSet = new LibDef.BT_VIBRATOR_PARAM();		// Vibrator operation structure (Set)
            // //Set to repeat "500 ms on, 500 ms off" 3 times
            //stVibSet.dwOn = 100;		// Rumble time [ms] (1 to 5000)
            //stVibSet.dwOff = 100;			// Stop time [ms] (0 to 5000)
            //stVibSet.dwCount = 0;		// Rumble count [times] (0 to 100)

            LibDef.BT_LED_PARAM stLedSet = new LibDef.BT_LED_PARAM();                           // LED control structure (Set)

            // Set to repeat "500 ms on, 500 ms off" 3 times
            stLedSet.dwOn    = 100;                     // Rumble time [ms] (1 to 5000)
            stLedSet.dwOff   = 100;                     // Stop time [ms] (0 to 5000)
            stLedSet.dwCount = 1;                       // Rumble count [times] (0 to 100)
            stLedSet.bColor  = LibDef.BT_LED_GREEN;     // Light color

            try
            {
                // btBuzzer Rumble
                ret = Device.btBuzzer(1, stBuzzerSet);
                if (ret != LibDef.BT_OK)
                {
                    disp = "error ret[" + ret + "]";
                    MessageBox.Show(disp, "Error btBuzzer");
                    return;
                }
                // btVibrator Rumble
                //     ret = Device.btVibrator(1, stVibSet);
                // btLED Light on
                ret = Device.btLED(1, stLedSet);

                if (ret != LibDef.BT_OK)
                {
                    disp = "error ret[" + ret + "]";
                    MessageBox.Show(disp, "Error btLED");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: fuadwi/Client-test
        private void callLED(int onTime, int offTime, int count, int color)
        {
            Int32  ret  = 0;
            String disp = "";

            LibDef.BT_LED_PARAM stLedSet = new LibDef.BT_LED_PARAM();                           // LED control structure (Set)

            // Set to repeat "500 ms on, 500 ms off" 3 times
            stLedSet.dwOn    = Convert.ToUInt16(onTime);                                // Rumble time [ms] (1 to 5000)
            stLedSet.dwOff   = Convert.ToUInt16(offTime);                               // Stop time [ms] (0 to 5000)
            stLedSet.dwCount = Convert.ToUInt16(count);                                 // Rumble count [times] (0 to 100)
            switch (color)
            {
            case 1:
                stLedSet.bColor = LibDef.BT_LED_BLUE;           // Light color
                break;

            case 2:
                stLedSet.bColor = LibDef.BT_LED_RED;            // Light color
                break;

            case 3:
                stLedSet.bColor = LibDef.BT_LED_CYAN;           // Light color
                break;

            case 4:
                stLedSet.bColor = LibDef.BT_LED_GREEN;          // Light color
                break;

            case 5:
                stLedSet.bColor = LibDef.BT_LED_MAGENTA;        // Light color
                break;

            case 6:
                stLedSet.bColor = LibDef.BT_LED_WHITE;          // Light color
                break;

            case 7:
                stLedSet.bColor = LibDef.BT_LED_YELLOW;         // Light color
                break;

            default:
                stLedSet.bColor = LibDef.BT_LED_WHITE;          // Light color
                break;
            }

            try
            {
                // btLED Light on
                ret = Device.btLED(1, stLedSet);
                if (ret != LibDef.BT_OK)
                {
                    disp = "btLED error ret[" + ret + "]";
                    MessageBox.Show(disp, "Error");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }