USB Bluetooth Device (HIDAPI) Library Call for Community Help/Input

Collaborate on tools, libraries, and applications beyond the IDE

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Locked
PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

USB Bluetooth Device (HIDAPI) Library Call for Community Help/Input

Post by PaulDaMacMan » Sat Mar 27, 2021 2:44 am

I've been working on a LiveCode Builder wrapper library for a couple of weeks now....
I've been thinking it would be great if people could try it out now in it's early stage and offer input in specific aspects of the library, and also possibly create device descriptions strings for any HID devices they might own (I've created 3 so far for Playstation 3 Controller, Nintendo Wiimote, and a Playstation 2 to USB Adapter).
Currently I'm trying to settle on a system for parsing the bytes coming in from the device that's being polled.
it would be nice to have a property in this library that can be set to a something like a formula that will then be used to post messages back to the LC engine based on the values of incoming bytes. I was thinking a script would set this parsing by passing a string with a blank space as the byte delimiter, a keyword for the type of processing (ignore byte, per bit, decimal value based) followed by a : colon sub-delimiter and then some token(s) for processing the byte with = as another delimiter followed by the message string to post back to the engine corresponding to that token/value...
I've started creating this system and already created device profiles for the devices I mentioned.
The system I currently have setup looks something like this

Code: Select all

-- Data Dscription looks something like this:
ignore bitArray=B8,B7,B5,ignore,Nyble:Dpad Zaxis=SignedInteger 
then in your stack you have scripts to handle these callbacks

Code: Select all

on Zaxis pZaxisValue
   put pZaxisValue into fld "Depth"
end Zaxis

on doButtonOn pButtonName
   if pButtonName = "B8" then send "MouseUp" to btn "B8"
end doButtonOn

on Dpad pNybleValue
   if pNybleValue = "5" then send "MouseUp" to btn "DpadDown"
end Dpad
I was originally thinking of making it a bit like the binaryDecode() function, but I've found that to be hard to work with because of the lack of descriptive names of data types (example 'b7' descibes next 7 bits of a byte of data)

Here is the latest demo video I made today that actually shows what I'm talking about in action:
https://www.youtube.com/watch?v=UElNxSq7r9k

Thoughts? Suggestions? Names for the Data Description property?
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: USB Bluetooth Device (HIDAPI) Library Call for Community Help/Input

Post by trevix » Tue Mar 30, 2021 4:07 pm

Very very interesting. What a work.
Is this a mobile library your building for, or just desktop?
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: USB Bluetooth Device (HIDAPI) Library Call for Community Help/Input

Post by PaulDaMacMan » Tue Mar 30, 2021 11:10 pm

trevix wrote:
Tue Mar 30, 2021 4:07 pm
Very very interesting. What a work.
Is this a mobile library your building for, or just desktop?
This is a LCB (LiveCode Builder Wrapper (+ some mostly LC-related code) Library that wraps the open-source, cross-platform HIDAPI Library, so if you can compile or find a pre-compiled binary of that for your mobile platform, put it an the appropriately named plaftorm folder in the "code" folder of this project folder, and make sure that the leaf name of the binary is "libhidapi" (+ .dll, .so, or .dynlib), then theoretically it should work on any LC supported platform with little or no modifications.
It does look like there's been some successful compiling of HIDAPI for Android (after all, Android pretty-much is Linux under the hood), see here:
https://github.com/libusb/hidapi/issues/24 and I found this link which suggests compiling for iOS is also possible: http://gtoal.com/vectrex/vecx-colour/SD ... idapi/ios/.
NOTE: I have not tested the Linux version, I've only tested under Windows 10 and macOS 10.14.6, so if anyone want's to test this on Linux and report back, that would be great! And if you can compile or find a binary of the HIDAPI for either mobile platform and send it to me, that would be good too!
Last edited by PaulDaMacMan on Sat Apr 03, 2021 5:30 pm, edited 1 time in total.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: USB Bluetooth Device (HIDAPI) Library Call for Community Help/Input

Post by PaulDaMacMan » Wed Mar 31, 2021 8:47 pm

PaulDaMacMan wrote:
Tue Mar 30, 2021 11:10 pm
NOTE: I have not tested the Linux version, I've only tested under Windows 10 and macOS 10.14.6, so if anyone want's to test this on Linux and report back, that would be great! And if you can compile or find a binary of the HIDAPI for either mobile platform and send it to me, that would be good too!
If you are going to try this on Linux then take note that there is TWO different versions of the HIDAPI binary for Linux, one of them has a dependency on LibUSB for it's back-end, while the other one uses HIDRAW, both versions are in the project folder (in LCB_HIDAPI/code/x86_64-linux/).
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: USB Bluetooth Device (HIDAPI) Library Call for Community Help/Input

Post by PaulDaMacMan » Tue Apr 06, 2021 3:10 am

I think I'm going to try to model the HID Input to LC Message Filter thing on this database which already has a bunch of mappings for Game controllers contributed by users (It's used by the popular SDL Library and KODI) or maybe make a function that reads in:
https://github.com/gabomdq/SDL_GameControllerDB
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Locked

Return to “Community Projects”