public static int GetLedCount() { NLED_COUNT_INFO countInfo = new NLED_COUNT_INFO(); int LEDCount = 0; if (NLedGetDeviceInfo(NLED_COUNT_INFO_ID, ref countInfo)) { LEDCount = (int)countInfo.cLeds; } return LEDCount; }
// Methods public Led() { NLED_COUNT_INFO pOutput = new NLED_COUNT_INFO(); if (!NativeMethods.NLedGetDeviceCount(0, ref pOutput)) { throw new Win32Exception(Marshal.GetLastWin32Error(), "Error Initialising LED's"); } this.m_count = (int)pOutput.cLeds; }
/// <summary> /// Initialise the LED collection /// </summary> public Led() { NLED_COUNT_INFO CountStruct = new NLED_COUNT_INFO(); if(!NLedGetDeviceCount(NLED_COUNT_INFO_ID,ref CountStruct)) { throw new Win32Exception(Marshal.GetLastWin32Error(), "Error Initialising LED's"); } m_count = (int)CountStruct.cLeds; }
public static int GetLedCount() { NLED_COUNT_INFO countInfo = new NLED_COUNT_INFO(); int LEDCount = 0; if (NLedGetDeviceInfo(NLED_COUNT_INFO_ID, ref countInfo)) { LEDCount = (int)countInfo.cLeds; } return(LEDCount); }
/// <summary> /// Initialise the LED collection /// </summary> public Led() { NLED_COUNT_INFO CountStruct = new NLED_COUNT_INFO(); if (!NativeMethods.NLedGetDeviceCount(NLED_COUNT_INFO_ID, ref CountStruct)) { throw new Win32Exception(Marshal.GetLastWin32Error(), "Error Initialising LED's"); } m_count = (int)CountStruct.cLeds; }
/// <summary> /// 获得LED个数 /// </summary> public int GetLedCount() { int wCount = 0; NLED_COUNT_INFO nci = new NLED_COUNT_INFO(); if (NLedGetDeviceInfo(NLED_COUNT_INFO_ID, nci)) { wCount = nci.cLeds; } return(wCount); }
private static int GetLedCount() { int count = 0; NLED_COUNT_INFO nci = new NLED_COUNT_INFO(); if (NLedGetDeviceInfo(NLED_COUNT_INFO_ID, nci)) { count = nci.cLeds; } return(count); }
public static uint GetLedCount() { NLED_COUNT_INFO nci = new NLED_COUNT_INFO(); uint LedCount = 0; if (NLedGetDeviceInfo(NLED_COUNT_INFO_ID, nci)) { LedCount = nci.cLeds; } return(LedCount); }
private static int GetVibrateLNum() { NLED_COUNT_INFO nci = new NLED_COUNT_INFO(); int wCount = 0, VibrLed = 0; NLED_SUPPORTS_INFO sup = new NLED_SUPPORTS_INFO(); if (NLedGetDeviceInfo(0, ref nci)) wCount = (int)nci.cLeds; for (int i = wCount - 1; i > -1; i--) { sup.LedNum = (uint)i; NLedGetDeviceInfo(1, ref sup); if (sup.lCycleAdjust == -1) { VibrLed = i; break; } } return VibrLed; }
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 ); }
private static int GetVibrateLNum() { NLED_COUNT_INFO nci = new NLED_COUNT_INFO(); int wCount = 0, VibrLed = 0; NLED_SUPPORTS_INFO sup = new NLED_SUPPORTS_INFO(); if (NLedGetDeviceInfo(0, ref nci)) { wCount = (int)nci.cLeds; } for (int i = wCount - 1; i > -1; i--) { sup.LedNum = (uint)i; NLedGetDeviceInfo(1, ref sup); if (sup.lCycleAdjust == -1) { VibrLed = i; break; } } return(VibrLed); }
private extern static bool NLedGetDeviceCount(short nID, ref NLED_COUNT_INFO pOutput);
private extern static bool NLedGetDeviceInfo(Int32 nID, NLED_COUNT_INFO nci);
static extern bool NLedGetDeviceInfo(int nInfoId, ref NLED_COUNT_INFO info);
extern static bool NLedGetDeviceInfo(uint nID, NLED_COUNT_INFO pOutput);
static extern bool NLedGetDeviceCount( short nID, ref NLED_COUNT_INFO pOutput );
private static extern bool NLedGetDeviceInfo(uint h, ref NLED_COUNT_INFO pOutput);
extern static bool NLedGetDeviceInfo(int nInfoId, ref NLED_COUNT_INFO info);
public static uint GetLedCount() { NLED_COUNT_INFO nci = new NLED_COUNT_INFO(); uint LedCount = 0; if (NLedGetDeviceInfo(NLED_COUNT_INFO_ID, nci)) LedCount = nci.cLeds; return LedCount; }