I'm building my own custom midi mapping app, and so far so good. I've been using nAudio to recieve midi messages, and it's working like a charm.
But when wanting to send something back, I run into some trouble. To enable a light on my controller I gotta send a Note On message: 90 kk 01 for example, where kk equals the corresponding key. (see picture below)
However, it is not working. I'm not getting any error messages at all, but nothing is lighting up neither.
Example of what I'm sending:
midiOut = new MidiOut(MIDIInDevice);
midiOut.Send(MidiMessage.StartNote(56, 1, 0).RawData);
56 is the Note, 1 the volume, and 0 the channel.
Any idea what i'm doing wrong?
The page you posted says that the lights are controlled with Note On messages. I'm not familiar with the C# library, but I'm guessing StopNote sends a Note Off message. Try using the equivalent that sends a Note On message. (Perhaps StartNote?)
Choose right channel and try to send NoteOn event.
var noteOnEvent = new NoteOnEvent(0L, channel, note, 127, 200);
midi.Send(noteOnEvent.GetAsShortMessage());
midi.Send(noteOnEvent.OffEvent.GetAsShortMessage());
Related
I'm trying send Information from Device A to Device B using Bluetooth Low Energy Advertisements.
In order to receive the broadcasts, I'm using Windows UWP's Bluetooth Low Energy Library (https://learn.microsoft.com/en-us/windows/uwp/devices-sensors/ble-beacon)
My received advertisements should include Information, but they don't. I tried to use BluetoothLEAdvertisementDataSection and BluetoothLEManufacturerData. Both aren't working. If I receive the Advertisement, the BluetoothLEAdvertisementDataSection doesn't include my information and the BluetoothLEManufacturerData is just empty.
This is what I receive:
Address: 0x2462ABE13A7E; Name:CH1234; RSSI: -49
ManufacturerDataLength: 0
ManufacurerData: []
DataSectionsLength: 4
DataSections: [0x06] [0x43-48-31-32-33-34] [0x03] [0x20-00-40-00]
The DataSections are about DataType 0x01, DataType 0x09, DataType 0x0A and 0x12
Is there any way to get the raw advertisement message? Or any other way to get this information?
I tried to receive Information from Advertisements using bluepy on Linux and it is working. Therefore the problem must be within this library.
This is my Code: https://pastebin.com/rxcrjhpj
There is not mutch. Just the BluetoothLEAdvertisementWatcher and printing the received Information.
///Edit
I fixxed it. The mistake was within sending the broadcast.
I use nkolban's ESP32 BLE Library, there are two functions. One called "BLEAdvertisementData.setManufacturerData" and the other one "BLEAdvertisementData.addData". However by using "addData" it looks like the broadcast frame gets messed up somehow. It's working if I just use "setManufacturerData" instead of "addData"
I want to capture image via SNAPI API from Symbol (currently Zebra) barcode scanner, model DS4208 (we're also using another but compatible models from Zebra).
Barcode capturing/recognition works pretty well, but looks like SnapiDLL.SNAPI_SnapShot(hScanner) call don't work correctly: no WM_XFERSTATUS message received at all.
Here is small & simplified code snippet:
// Set image format
short[] parms = new short[2] { (short)SnapiParamIds.ImageFileType, (short)SnapiImageTypes.Jpeg };
var retCode = SnapiDLL.SNAPI_SetParameters(parms, 2, _devHandles[0]);
Debug.WriteLine($"SNAPI_SetParameters retCode={retCode}");
Application.DoEvents();
Thread.Sleep(50);
retCode = SnapiDLL.SNAPI_SnapShot(_devHandles[0]);
Debug.WriteLine($"SNAPI_SnapShot retCode={retCode}");
Application.DoEvents();
Thread.Sleep(50);
retCode = SnapiDLL.SNAPI_PullTrigger(_devHandles[0]);
Debug.WriteLine($"SNAPI_PullTrigger retCode={retCode}");
Application.DoEvents();
Thread.Sleep(50);
Return codes always 0 (i.e. no error), but no WM_XFERSTATUS message received by my message handler.
P.S. C# application from Zebra's SDK which is using CoreScanner driver and OCX, is working fine and able to capture images and video. But I'd like to avoid CoreScanner driver installation for some reasons; for barcode scanning small and simple SNAPI.dll works pretty fine, and I expect to get it work for image capturing too - probably, I'm doing something wrong...
P.P.S. Guys, please DO NOT COMMENT if you have NO EXPERIENCE WORKING WITH SYMBOL BARCODE SCANNERS & SNAPI, and CAN NOT PROVIDE a working snippet!
After contacting Zebra tech support (they are successors of Symbol/Motorola barcode scanner business), I figured out that the imaging/video functionality is broken in SNAPI.dll for the x64 OSes (but most of the rest API calls are working properly). Unfortunately, SNAPI isn't supported by Zebra anymore, and I should use Zebra's CoreScanner API. The good news is: this API is working fine, as it supposed to be. Not a very good news: I should use additional installation package from Zebra.
I'm writing a discord bot in .net, and I need to get the name of the game being streamed by a user.
In discord.py, this is possible with https://discordpy.readthedocs.io/en/rewrite/api.html?highlight=guild#discord.Streaming.details.
I'd like to do this in discord.net, but 'Activity', along with Activity cast to Game and StreamingGame, all return the name of the stream (when streaming), not the actual name of the game. (RichGame gives a null reference exception.)
The game being played is visible when viewing a streaming user on Discord, but as far as I could see, not in the API. So how does discord.py get it?
I checked other libraries and it seems discord.py is the only one supporting it.
I tried to read the source code, but I'm not at all well-versed enough in python to understand it.
Example below:
var user = _client.GetGuild(0).GetUser(0);
Console.WriteLine($"Activity - {user.Activity.Name}");
Console.WriteLine($"Type - {user.Activity.Type}");
var Game = user.Activity as Game;
Console.WriteLine($"Game - {Game.Name}");
var StreamingGame = user.Activity as StreamingGame;
Console.WriteLine($"StreamingGame - {StreamingGame.Name}");
Returns:
Type - Streaming
Game - !giveaway ... Fallout 2 war eh das beste...
StreamingGame - !giveaway ... Fallout 2 war eh das beste...
Querying the the twitch API works, but seems excessive, considering it's available in the discord.py library.
Any help would be appreciated, thank you.
I am trying to create a text msg/sms gateway using a USB-HSDPA Modem from Huawei (E122-1).
I have done this with an older Modem some time ago. After some troubles installing the driver and receiving the correct comPort of the new device I have finally established to communicate with the device.
comPort Check and PIN-Check are already done.
Now I'm switching to textmode (CMGF) and write the message (CMGS):
comPort.Write("AT+CMGF=1\r\n");
Thread.Sleep(1000);
comPort.Write("AT+CMGS=\"" + "some tel no" + "\"" + Environment.NewLine);
comPort.Write("text content" + (char)26 + Environment.NewLine);
Thread.Sleep(2000);
response = comPort.ReadExisting();
everything works fine, i get proper responses and everything.
BUT, here is the problem: the sent text message can't be read on all mobile phones/smart phones:
- my old Nokia 6300 says 'unsupported message type'.
- HTC Desire shows an empty message.
- Samsung Galaxy S2 'content is not supported'.
- Samsung Galaxy S shows the message just fine.
Now here is the weird thing, if i use the application which comes with the modem (t-mobile austria internet manager) to send a text message, all of the listed devices can display it correctly.
am I missing something with the encoding or some kind of a header? (which the 't-mobile internet manager' apparently is using for correct displaying of the text message at the receiver side)
any suggestions or ideas?
thanks,
Sise
somehow, the receiver devices are expecting PDU format and not ascii.
something like:
http://www.dreamfabric.com/sms/
but the receiver device i'm requiring this method for is a gps-tracking box and it does understand ascii, so pdu is not required and the application is working fine.
thanks anyways! :)
Try to send in text mode: https://www.diafaan.com/sms-tutorials/gsm-modem-tutorial/at-cmgf/
AT+CMGF=
1 = Text Mode
I have coding I almost always use with my Omnikey RFID CardMan 5321 smart cards. Problem is we received new cards today which are marked "HID iCLASS GL" which do not appear to be working well with our coding.
Without going through the whole source, our problem is arising when we are calling the following line, which basically tells us the length of the data:
lResult = SCardTransmit(hCard, 0, bytCommand, lLen, 0, byReadBuffer, iReturnlength)
We are returning only a length of 2, which the data is marked as "x69 x86". Even if I tell it to read all 255 chr's the rest are just marked as null.
Now I know our reader can read these cards since the OMNIKEY Diagnostic tool is showing us the following:
Status: Smart Card Inserted
FW: 5.10
Port: USB
Lib: 1.0
Smart Card Nme: iCLASS 32KS 8x2+16
ART: Valid
Protocol: ISO 15693 (Part 2)
PICCtoPCD: 26,48 kbps
PCDtoPICC: 26,48 kbps
Frequ: 13.56 MHz
As I explained before, everything is working fine in my coding except no data is being returned for my card besides "x69 x86", which is surely not correct.
If anyone has any experience reading from a HID iCLASS card, I would greatly appreciate some feedback on how to. Even if we have to license software, that is ok.
Thanks in advance!
in case you are trying to access physical access data, I would thoroughly check the crypto protocol between reader and host first and also meke sure you are using a reader with teh latest firmware (5.20 for the OMNIKEY 5321).
I would also introduce code to check the card system withour secure communication channel between host and reader application.
Further references:
http://www.hidglobal.com/documents/ok_contactless_developer_guide_an_en.pdf
The reason cause you get a 2 Byte array is cause your command runs on an error so the chip returns only SW1 and SW2 Flag
in your case it's meaning is
x69 --> Command not allowed (further qualification in SW2, see table 17)
x86 --> Command not allowed (no current EF)
So you might proof that your application file on the chip is correctly selected
further information #
http://www.cardwerk.com/smartcards/smartcard_standard_ISO7816-4_5_basic_organizations.aspx#table17