private void _updateSymbols() { byte[] WriteBuffer = new byte[9]; int tmp = _SymbolsVisible.Data; WriteBuffer[2] = (byte)(tmp >> 8); WriteBuffer[3] = (byte)(tmp & 0xff); if (_Volume >= 0) // for Volume<0 don't show Volume symbols { WriteBuffer[3] |= 0x04; for (int j = 3; j < 9; j++) { if ((float)_Volume / 4 > j - 3) { WriteBuffer[j] = (byte)(WriteBuffer[j] | 0x08); } if ((float)_Volume / 4 - 0.5 > j - 3) { WriteBuffer[j] = (byte)(WriteBuffer[j] | 0x80); } } } if (Process.GetProcessesByName("ehshell").Length > 0) { return; //exit if xpMCE is running } Hid.OutputReport myOutputReport = new Hid.OutputReport(); myOutputReport.Write(new byte[] { 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(WriteBuffer, _HIDHandle); }
/// <summary> /// Writes with big letter to VFD /// </summary> /// <param name="text"></param> public void writeMainScreen(string text) { if (_VendorID == 0x0547 && _ProductID == 0x7000) { // write single line into display writeLine(0, text); } else { byte[] WriteBuffer = new byte[18]; byte[] WB1 = new byte[9]; byte[] WB2 = new byte[9]; if (Process.GetProcessesByName("ehshell").Length > 0) { return; //exit if xpMCE is running } for (int i = 0; i < text.Length; i++) { WriteBuffer[i + 1] = (byte)(text[i]); } for (int i = 1; i < 9; i++) { WB1[i] = WriteBuffer[i]; WB2[i] = WriteBuffer[i + 8]; } Hid.OutputReport myOutputReport = new Hid.OutputReport(); myOutputReport.Write(new byte[] { 0x00, 0x06, 0x05, 0x02, 0x01, 0x05, 0x00, 0x08, 0x00 }, _HIDHandle); myOutputReport.Write(new byte[] { 0x00, 0x06, 0x03, 0x01, 0x0A, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(WB1, _HIDHandle); // Text 1-8 myOutputReport.Write(WB2, _HIDHandle); // Text 9-14 } }
/// <summary> /// Initializes the VFD screen, including opening of USB /// </summary> public void initScreen() { if (!FindTheHid()) { throw new NotSupportedException("Display not found"); } if (_VendorID == 0x0547 && _ProductID == 0x7000) { clearLines(); } else if (_VendorID == 0x051c && _ProductID == 0x0005) { // Shuttle PF27 is handled in driver } else { if (Process.GetProcessesByName("ehshell").Length > 0) { return; //exit if xpMCE is running } //code for Scaleo EV only Hid.OutputReport myOutputReport = new Hid.OutputReport(); myOutputReport.Write(new byte[] { 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(new byte[] { 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(new byte[] { 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(new byte[] { 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); } }
public void updateFICSymbol(FICSymbols vfdsymbol, bool visible) { if (FICIconStatus[(int)vfdsymbol] != visible) { int i; // FIC Spectra Symbol Hid.OutputReport myOutputReport = new Hid.OutputReport(); // reset USB write buffer byte[] WriteBuffer = new byte[65]; for (i = 0; i < 65; i++) { WriteBuffer[i] = 0; } WriteBuffer[1] = 0x85; WriteBuffer[2] = 0x02; WriteBuffer[3] = 0x01; WriteBuffer[4] = (byte)vfdsymbol; if (visible) { WriteBuffer[5] = 0x01; } else { WriteBuffer[5] = 0x00; } myOutputReport.Write(WriteBuffer, _HIDHandle); FICIconStatus[(int)vfdsymbol] = visible; } }
/// <summary> /// Clears the VFD /// </summary> public void clearScreen() { if (_VendorID == 0x0547 && _ProductID == 0x7000) { // FIC Spectra clear screen writeLine(0, " "); setVolume(0); updateFICSymbol(FICSymbols.Volume, false); updateFICSymbol(FICSymbols.Home, false); } else { if (Process.GetProcessesByName("ehshell").Length > 0) { return; //exit if xpMCE is running } Hid.OutputReport myOutputReport = new Hid.OutputReport(); myOutputReport.Write(new byte[] { 0x00, 0x04, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); //clear screen myOutputReport.Write(new byte[] { 0x00, 0x04, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(new byte[] { 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); myOutputReport.Write(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); } }
/// <summary> /// sets the Volume symbols on the VFD /// </summary> /// <param name="volume"></param> public void setVolume(int volume) // 12 Balken { if (_VendorID == 0x0547 && _ProductID == 0x7000) { // fic spectra if (volume != _Volume) { _Volume = volume; int i; // set volume icon updateFICSymbol(FICSymbols.Volume, true); Hid.OutputReport myOutputReport = new Hid.OutputReport(); // reset USB write buffer byte[] WriteBuffer = new byte[65]; for (i = 0; i < 65; i++) { WriteBuffer[i] = 0; } WriteBuffer[1] = 0x85; WriteBuffer[2] = 0x02; WriteBuffer[3] = 0x0B; for (i = 1; i < 12; i++) { WriteBuffer[4 + (i - 1) * 2] = (byte)(i + 1); if (volume >= i) { WriteBuffer[5 + (i - 1) * 2] = 1; } else { WriteBuffer[5 + (i - 1) * 2] = 0; } } myOutputReport.Write(WriteBuffer, _HIDHandle); } } else { // Scaleo E _Volume = volume; _updateSymbols(); } }
/// <summary> /// Sends an HID output report to VFD device. /// </summary> /// <param name="reportBuffer">contains the report ID and report data.</param> /// <returns>True on success. False on failure.</returns> public bool WriteHidOutputReport(byte[] reportBuffer) { Hid.OutputReport outputReport = new Hid.OutputReport(); return(outputReport.Write(reportBuffer, _HIDHandle)); }
/// <summary> /// Writes with small letter in 2 lines; /// Second line scrolls to the left if longer than 18 chars /// </summary> /// <param name="LineNo"></param> /// <param name="text"></param> public void writeLine(int LineNo, string text) { if (_VendorID == 0x0547 && _ProductID == 0x7000) { //write line on FIC Spectra Display byte[] WriteBuffer = new byte[65]; WriteBuffer[1] = 0x8B; WriteBuffer[2] = 0x04; WriteBuffer[3] = 0x01; WriteBuffer[4] = (byte)text.Length; for (int i = 0; i < text.Length; i++) { WriteBuffer[i + 5] = (byte)(text[i]); } Hid.OutputReport myOutputReport = new Hid.OutputReport(); myOutputReport.Write(WriteBuffer, _HIDHandle); } else { //write line for Scaleo byte[] WriteBuffer = new byte[50]; byte[] WB1 = new byte[9]; byte[] WB2 = new byte[9]; byte[] WB3 = new byte[9]; byte[] WB4 = new byte[9]; byte[] WB5 = new byte[9]; byte[] WB6 = new byte[9]; if (Process.GetProcessesByName("ehshell").Length > 0) { return; //exit if xpMCE is running } for (int i = 0; i < text.Length; i++) { WriteBuffer[i + 1] = (byte)(text[i]); } for (int i = 1; i < 9; i++) { WB1[i] = WriteBuffer[i]; WB2[i] = WriteBuffer[i + 8]; WB3[i] = WriteBuffer[i + 16]; WB4[i] = WriteBuffer[i + 24]; WB5[i] = WriteBuffer[i + 32]; WB6[i] = WriteBuffer[i + 40]; } Hid.OutputReport myOutputReport = new Hid.OutputReport(); //7 0x06 //6 0x03 //5 1=obli 3=unli 2=obre 4=unre scroll hängt auch von der Vergangenheit ab??? //4 text.Length //3 //2 0x00 //1 0x00 //0 0x00 if (LineNo == 0) { // erase line 1 myOutputReport.Write(new byte[] { 0x00, 0x04, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); // init line 1 myOutputReport.Write(new byte[] { 0x00, 0x06, 0x03, 0x01, (byte)text.Length, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); } else { // erase line 2 myOutputReport.Write(new byte[] { 0x00, 0x04, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); // init line 2 myOutputReport.Write(new byte[] { 0x00, 0x06, 0x03, 0x03, (byte)text.Length, 0x00, 0x00, 0x00, 0x00 }, _HIDHandle); } // write text myOutputReport.Write(WB1, _HIDHandle); // Text 1-8 if (text.Length > 8) { myOutputReport.Write(WB2, _HIDHandle); // Text 9-14 } if (text.Length > 16) { myOutputReport.Write(WB3, _HIDHandle); // Text 9-16 } if (text.Length > 24) { myOutputReport.Write(WB4, _HIDHandle); // Text 9-16 } if (text.Length > 32) { myOutputReport.Write(WB5, _HIDHandle); // Text 9-16 } if (text.Length > 40) { myOutputReport.Write(WB6, _HIDHandle); // Text 9-16 } // write trailer myOutputReport.Write(new byte[] { 0x00, 0x06, 0x05, 0x02, 0x02, 0x05, 0x00, 0x80, 0x00 }, _HIDHandle); if (text.Length > 18) { myOutputReport.Write(new byte[] { 0x00, 0x06, 0x05, 0x02, 0x02, 0x05, 0x00, 0x84, 0x00 }, _HIDHandle); } } }
/// <summary> /// Sends an HID output report to VFD device. /// </summary> /// <param name="reportBuffer">contains the report ID and report data.</param> /// <returns>True on success. False on failure.</returns> public bool WriteHidOutputReport(byte[] reportBuffer) { Hid.OutputReport outputReport = new Hid.OutputReport(); return outputReport.Write(reportBuffer, _HIDHandle); }
/// <summary> /// Writes with small letter in 2 lines; /// Second line scrolls to the left if longer than 18 chars /// </summary> /// <param name="LineNo"></param> /// <param name="text"></param> public void writeLine(int LineNo, string text) { if (_VendorID == 0x0547 && _ProductID == 0x7000) { //write line on FIC Spectra Display byte[] WriteBuffer = new byte[65]; WriteBuffer[1] = 0x8B; WriteBuffer[2] = 0x04; WriteBuffer[3] = 0x01; WriteBuffer[4] = (byte)text.Length; for (int i = 0; i < text.Length; i++) { WriteBuffer[i + 5] = (byte)(text[i]); } Hid.OutputReport myOutputReport = new Hid.OutputReport(); myOutputReport.Write(WriteBuffer, _HIDHandle); } else { //write line for Scaleo byte[] WriteBuffer = new byte[50]; byte[] WB1 = new byte[9]; byte[] WB2 = new byte[9]; byte[] WB3 = new byte[9]; byte[] WB4 = new byte[9]; byte[] WB5 = new byte[9]; byte[] WB6 = new byte[9]; if (Process.GetProcessesByName("ehshell").Length > 0) { return; //exit if xpMCE is running } for (int i = 0; i < text.Length; i++) { WriteBuffer[i + 1] = (byte)(text[i]); } for (int i = 1; i < 9; i++) { WB1[i] = WriteBuffer[i]; WB2[i] = WriteBuffer[i + 8]; WB3[i] = WriteBuffer[i + 16]; WB4[i] = WriteBuffer[i + 24]; WB5[i] = WriteBuffer[i + 32]; WB6[i] = WriteBuffer[i + 40]; } Hid.OutputReport myOutputReport = new Hid.OutputReport(); //7 0x06 //6 0x03 //5 1=obli 3=unli 2=obre 4=unre scroll hängt auch von der Vergangenheit ab??? //4 text.Length //3 //2 0x00 //1 0x00 //0 0x00 if (LineNo == 0) { // erase line 1 myOutputReport.Write(new byte[] {0x00, 0x04, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); // init line 1 myOutputReport.Write(new byte[] {0x00, 0x06, 0x03, 0x01, (byte)text.Length, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); } else { // erase line 2 myOutputReport.Write(new byte[] {0x00, 0x04, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); // init line 2 myOutputReport.Write(new byte[] {0x00, 0x06, 0x03, 0x03, (byte)text.Length, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); } // write text myOutputReport.Write(WB1, _HIDHandle); // Text 1-8 if (text.Length > 8) { myOutputReport.Write(WB2, _HIDHandle); // Text 9-14 } if (text.Length > 16) { myOutputReport.Write(WB3, _HIDHandle); // Text 9-16 } if (text.Length > 24) { myOutputReport.Write(WB4, _HIDHandle); // Text 9-16 } if (text.Length > 32) { myOutputReport.Write(WB5, _HIDHandle); // Text 9-16 } if (text.Length > 40) { myOutputReport.Write(WB6, _HIDHandle); // Text 9-16 } // write trailer myOutputReport.Write(new byte[] {0x00, 0x06, 0x05, 0x02, 0x02, 0x05, 0x00, 0x80, 0x00}, _HIDHandle); if (text.Length > 18) { myOutputReport.Write(new byte[] {0x00, 0x06, 0x05, 0x02, 0x02, 0x05, 0x00, 0x84, 0x00}, _HIDHandle); } } }
/// <summary> /// Clears the VFD /// </summary> public void clearScreen() { if (_VendorID == 0x0547 && _ProductID == 0x7000) { // FIC Spectra clear screen writeLine(0, " "); setVolume(0); updateFICSymbol(FICSymbols.Volume, false); updateFICSymbol(FICSymbols.Home, false); } else { if (Process.GetProcessesByName("ehshell").Length > 0) { return; //exit if xpMCE is running } Hid.OutputReport myOutputReport = new Hid.OutputReport(); myOutputReport.Write(new byte[] {0x00, 0x04, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); //clear screen myOutputReport.Write(new byte[] {0x00, 0x04, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(new byte[] {0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); } }
/// <summary> /// Writes with big letter to VFD /// </summary> /// <param name="text"></param> public void writeMainScreen(string text) { if (_VendorID == 0x0547 && _ProductID == 0x7000) { // write single line into display writeLine(0, text); } else { byte[] WriteBuffer = new byte[18]; byte[] WB1 = new byte[9]; byte[] WB2 = new byte[9]; if (Process.GetProcessesByName("ehshell").Length > 0) { return; //exit if xpMCE is running } for (int i = 0; i < text.Length; i++) { WriteBuffer[i + 1] = (byte)(text[i]); } for (int i = 1; i < 9; i++) { WB1[i] = WriteBuffer[i]; WB2[i] = WriteBuffer[i + 8]; } Hid.OutputReport myOutputReport = new Hid.OutputReport(); myOutputReport.Write(new byte[] {0x00, 0x06, 0x05, 0x02, 0x01, 0x05, 0x00, 0x08, 0x00}, _HIDHandle); myOutputReport.Write(new byte[] {0x00, 0x06, 0x03, 0x01, 0x0A, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(WB1, _HIDHandle); // Text 1-8 myOutputReport.Write(WB2, _HIDHandle); // Text 9-14 } }
private void _updateSymbols() { byte[] WriteBuffer = new byte[9]; int tmp = _SymbolsVisible.Data; WriteBuffer[2] = (byte)(tmp >> 8); WriteBuffer[3] = (byte)(tmp & 0xff); if (_Volume >= 0) // for Volume<0 don't show Volume symbols { WriteBuffer[3] |= 0x04; for (int j = 3; j < 9; j++) { if ((float)_Volume / 4 > j - 3) { WriteBuffer[j] = (byte)(WriteBuffer[j] | 0x08); } if ((float)_Volume / 4 - 0.5 > j - 3) { WriteBuffer[j] = (byte)(WriteBuffer[j] | 0x80); } } } if (Process.GetProcessesByName("ehshell").Length > 0) { return; //exit if xpMCE is running } Hid.OutputReport myOutputReport = new Hid.OutputReport(); myOutputReport.Write(new byte[] {0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(WriteBuffer, _HIDHandle); }
/// <summary> /// Initializes the VFD screen, including opening of USB /// </summary> public void initScreen() { if (!FindTheHid()) { throw new NotSupportedException("Display not found"); } if (_VendorID == 0x0547 && _ProductID == 0x7000) { clearLines(); } else if (_VendorID == 0x051c && _ProductID == 0x0005) { // Shuttle PF27 is handled in driver } else { if (Process.GetProcessesByName("ehshell").Length > 0) { return; //exit if xpMCE is running } //code for Scaleo EV only Hid.OutputReport myOutputReport = new Hid.OutputReport(); myOutputReport.Write(new byte[] {0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(new byte[] {0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(new byte[] {0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(new byte[] {0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); myOutputReport.Write(new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, _HIDHandle); } }