Beispiel #1
0
 private static void LedOn(int id)
 {
     NLED_SETTINGS_INFO settings = new NLED_SETTINGS_INFO();
     settings.LedNum = id;
     settings.OffOnBlink = 1;
     NLedSetDevice(id, ref settings);
 }
Beispiel #2
0
 public void SetLedStatus(int led, LedState newState)
 {
     NLED_SETTINGS_INFO pOutput = new NLED_SETTINGS_INFO();
     pOutput.LedNum = led;
     pOutput.OffOnBlink = (int)newState;
     NLedSetDevice(2, ref pOutput);
 }
Beispiel #3
0
		/// <summary>
		/// Set the state of the specified LED
		/// </summary>
		/// <param name="led">0 based index of the LED</param>
		/// <param name="newState">New state of the LED - see LedState enumeration</param>
		public void SetLedStatus(int led, LedState newState)
		{
			NLED_SETTINGS_INFO nsi = new NLED_SETTINGS_INFO();

			nsi.LedNum = led;
			nsi.OffOnBlink = (int)newState;
			bool bSuccess = NLedSetDevice(NLED_SETTINGS_INFO_ID, ref nsi);
		}
        public static void Vibrate( int time )
        {
            NLED_COUNT_INFO CountStruct = new NLED_COUNT_INFO();
            if( !NLedGetDeviceCount( NLED_COUNT_INFO_ID, ref CountStruct ) )
                throw new NotSupportedException( "Not supported in this device." );
            //Error Initialising LEDs

            uint m_count = CountStruct.cLeds;

            NLED_SETTINGS_INFO nsi = new NLED_SETTINGS_INFO();

            // vibrate on
            nsi.LedNum = m_count - 1;
            nsi.OffOnBlink = ( int )LedState.On;
            NLedSetDevice( 2, ref nsi );

            // sleep for specified time
            System.Threading.Thread.Sleep( time );

            // vibrate off
            nsi.OffOnBlink = ( int )LedState.Off;
            NLedSetDevice( 2, ref nsi );
        }
Beispiel #5
0
 private static extern bool NLedSetDevice(uint h, ref NLED_SETTINGS_INFO pOutput);
Beispiel #6
0
 public void SetLedStatus(int led, LedState newState)
 {
     NLED_SETTINGS_INFO pOutput = new NLED_SETTINGS_INFO
     {
         LedNum = led,
         OffOnBlink = (int)newState
     };
     NativeMethods.NLedSetDevice(2, ref pOutput);
 }
            public static bool SetLedStatus(uint nLed, LedFlags fState)
            {
                NLED_SETTINGS_INFO nsi = new NLED_SETTINGS_INFO();

                nsi.LedNum = nLed;
                nsi.OnOffBlink = fState;

                return NLedSetDevice(NLED_SETTINGS_INFO_ID, nsi);
            }
 private extern static bool NLedSetDevice(Int32 nID, NLED_SETTINGS_INFO nsi);
Beispiel #9
0
 static extern bool NLedGetDeviceInfo(int nInfoId, ref NLED_SETTINGS_INFO info);
Beispiel #10
0
 extern static bool NLedGetDeviceInfo(int nInfoId, ref NLED_SETTINGS_INFO info);
Beispiel #11
0
 private static extern bool NLedSetDevice(uint h, ref NLED_SETTINGS_INFO pOutput);
 static extern bool NLedSetDevice( short nID, ref NLED_SETTINGS_INFO pOutput );
Beispiel #13
0
 private extern static bool NLedSetDevice(short nID, ref NLED_SETTINGS_INFO pOutput);
Beispiel #14
0
 private static extern bool NLedGetDeviceInfo(Int32 nID, NLED_SETTINGS_INFO nsi);
Beispiel #15
0
        public static void SetLedStatus(uint wLed, int wStatus)
        {
            if (!AvailableLed(wLed)) throw new InvalidOperationException();

            NLED_SETTINGS_INFO settingInfo = new NLED_SETTINGS_INFO();
            settingInfo.LedNum = wLed;
            settingInfo.OffOnBlink = System.Convert.ToUInt16(wStatus);
            settingInfo.OnTime = 1000000;
            settingInfo.OffTime = 500000;
            //settingInfo.MetaCycleOn = 1;
            //settingInfo.MetaCycleOff = 20;
            NLedSetDevice(NLED_SETTINGS_INFO_ID, ref settingInfo);
        }
Beispiel #16
0
 extern static bool NLedSetDevice(int deviceId, ref NLED_SETTINGS_INFO info);
Beispiel #17
0
 private extern static bool NLedSetDevice(Int32 nID, NLED_SETTINGS_INFO nsi);
Beispiel #18
0
 static extern bool NLedSetDevice(int deviceId, ref NLED_SETTINGS_INFO info);
Beispiel #19
0
        /// <summary>
        /// Vibrate function using unmanaged NLedSetDevice function.
        /// </summary>
        /// <param name="state">true - turns on vibrate / false - turns off.</param>
        static void SetVibrate(bool state)
        {
            // Instantiate a new object from the structure we created
            NLED_SETTINGS_INFO info = new NLED_SETTINGS_INFO();

            // Sets the LED number to be used, this is based on the LED device
            // capabilities but in the case of virbation shouldn't matter.
            info.LedNum = 1;

            // sets the state of the LED, with vibrate it can only be on or off
            // but a value of 2 for blink can base used in other cases
            info.OffOnBlink = state ? 1 : 0;

            // Actually sets the device to enable vibration or disable it. the 1 subsection is the DeviceID,
            // in this case and most phone cases this will be device 1, the second subsection is passing the
            // information from the info structure.
            NLedSetDevice(1, ref info);
        }