Event Broadcasting in the 3DxValuesCarbon example code

Post questions, comments and feedback to our 3Dconnexion Mac Development Team.

Moderator: Moderators

Post Reply
dvmorris
Posts: 10
Joined: Thu Apr 12, 2007 10:19 pm

Event Broadcasting in the 3DxValuesCarbon example code

Post by dvmorris » Mon Apr 16, 2007 10:01 am

I am implementing the sample code from the 3DxValuesCarbon example in a Qt application I'm compiling with qmake, and the spacenavigator only seems to broadcast an event when I click the buttons, but not when I move the knob around.

I display a mesasge box in the top of the tdx_drv_handler function which should receive all the events from the SpaceNavigator, but it only shows the message when I click one of the buttons on the device. Am I missing something?

It also doesn't seem to be recognizing the messageType properly in the switch(messageType) statement. It's jumping straight to the default case no matter what cases I put in there.

I hope this makes sense, thanks for the help.
dave

dvmorris
Posts: 10
Joined: Thu Apr 12, 2007 10:19 pm

Post by dvmorris » Mon Apr 16, 2007 1:01 pm

I just noticed that when i hit the "calibrate" button in the 3d connexion settings panel, it broadcasts two events to my application. I don't know if that helps explain my problem any better.

flomotan
Moderator
Moderator
Posts: 287
Joined: Mon Jan 08, 2007 3:37 pm

Post by flomotan » Tue Apr 17, 2007 9:44 am

A couple of things to check.

- Be sure to get the latest driver v1.0.2. This has the latest data structure definitions.

- When you're calling RegisterConnexionClient, pass kConnexionClientModeTakeOver as the mode and try kConnexionMaskAxis | kConnexionMaskButtons as the mask. kConnexionMaskAll should also work.

dvmorris
Posts: 10
Joined: Thu Apr 12, 2007 10:19 pm

Post by dvmorris » Tue Apr 17, 2007 2:57 pm

I do have the latest version of the driver, and I am already passing kConnexionClientModeTakeOver and kConnexionMaskAll to the register function.

It just seems strange that the buttons do work, but moving the knob won't call the callback functions.

Any other ideas?

flomotan
Moderator
Moderator
Posts: 287
Joined: Mon Jan 08, 2007 3:37 pm

Post by flomotan » Tue Apr 17, 2007 9:35 pm

Other things to check or try:

- In RegisterConnexionClient, pass a unique 32bit signature for your app

- Create a setting for your application in the 3Dconnexion preference pane. You can do this by selecting "Add Applicaton..." on the popup menu and selecting the app you're developing

- Try changing the mask to kConnexionMaskAxis | kConnexionMaskButtons.

dvmorris
Posts: 10
Joined: Thu Apr 12, 2007 10:19 pm

Post by dvmorris » Wed Apr 18, 2007 12:18 am

I had been passing this as my unique id for my app:

'topmod'

and i just tried this and nothing changed:

(UInt32)('TopMod2007')

and it did not work either. I have tried the other mask setting, and I added the application to the preference pane before I had started any of this code writing process.

Another thing I just noticed is that the buttons only seem to call the callback function when they are set to the "open preference pane" action. Otherwise the button clicks don't call the callback function.

Also, when I am in another program, but have my app open in the background, the right button will call the callback function but the left one will only call it when the app has focus. None of this is adding up, and I really sorry to keep bothering you.

Is there anything else to try?

dvmorris
Posts: 10
Joined: Thu Apr 12, 2007 10:19 pm

Post by dvmorris » Wed Apr 18, 2007 12:45 am

does it make a difference that it's a personal edition spacenavigator?

flomotan
Moderator
Moderator
Posts: 287
Joined: Mon Jan 08, 2007 3:37 pm

Post by flomotan » Fri Apr 20, 2007 9:50 am

The ID for your application would be the same as your CFBundleSignature. An example would be 'TopM'. Make sure you also use this same ID for your CFBundleSignature.

It's okay to use SpaceNavigator PE with the framework. That's a totally supported device

dvmorris
Posts: 10
Joined: Thu Apr 12, 2007 10:19 pm

Post by dvmorris » Fri Apr 20, 2007 2:33 pm

I can find virtually no documentation about how to use CFBundleSignature, let alone how to use it with Qt.

The 3dxMacWare SDK pdf file simply says:
CFBundleSignature:
Your application’s creator signature. This is the 32-bit CFBundleSignature value.
You can pass zero (0) if your application does not have one. If you pass 0, you
must provide a valid name parameter. The driver uses this value to identify if
your application is the active (front-most) application.
and for name it says
This is your application’s executable name formatted as a Pascal string (e.g.
“\pMyApplication”). Note that this string is the actual executable and not the
application bundle name. You may pass NULL but if you do, the signature
parameter must be a valid CFBundleSignature value.
So I attempted to manually edit my info.plist file inside the app bundle after compiling to set CFBundleSignature to 'TopM', and send NULL for the name. That didn't work.

I also tried not setting the CFBundleSignature, and setting the name to '\pTopMod', but it will not accept that as a UInt* value. Then I tried typecasting it but then it gets an error when I compile it.

The documentation seems a bit incomplete to me, but maybe I'm just not experienced enough with Mac development. It seems like it should be way easier than this, and I have nowhere else to go for help,
Dave

ettore
Moderator
Moderator
Posts: 127
Joined: Wed Mar 14, 2007 5:55 pm
Location: SF Bay Area, CA
Contact:

Post by ettore » Tue May 08, 2007 12:02 pm

dvmorris wrote:I had been passing this as my unique id for my app:

'topmod'

and i just tried this and nothing changed:

(UInt32)('TopMod2007')
Hi Dave,
you can't have an ID longer than 4 chars since in total it's a 32bit unsigned int. So as you said, let's use 'TopM'. Now, please verify this:

- in your Info.plist file: the CFBundleSignature entry should be:

Code: Select all

<key>CFBundleSignature</key>
<string>TopM</string>
- in your main.c file or wherever you initialize the device use one of the 2 following calls:

Code: Select all

TdxInitDevice('TopM', TRUE,  kConnexionClientModeTakeOver, kConnexionMaskAll);

Code: Select all

yourClientID = RegisterConnexionClient('TopM', "\pYourAppName", kConnexionClientModeTakeOver, kConnexionMaskAll);
TdxInitDevice is just a wrapper for RegisterConnexionClient (and more) so don't use both!

Hope this helps.
ettore pasquini
software engineer
3Dconnexion, inc.

dvmorris
Posts: 10
Joined: Thu Apr 12, 2007 10:19 pm

Post by dvmorris » Mon May 14, 2007 1:06 am

I am doing everything right as far as I can tell. This is the output from the callback function when I click one of the buttons, but turning the knob or tilting or twisting it doesn't call the callback function still.

The documentation is absolutely not clear enough to make this thing work. Has anyone ever actually gotten it to work with their own app before?

Code: Select all

front app client: 0  ourID: 8206
command: 255
value: 0
param: 0
report[0]: 0
report[1]: 0
report[2]: 0
report[3]: 0
report[4]: 0
report[5]: 0
report[6]: 0
report[7]: 0
buttons: 0
TX: 0
TY: 0
TZ: 0
RX: 0
RY: 0
RZ: 0
-----------------------------------------


ettore
Moderator
Moderator
Posts: 127
Joined: Wed Mar 14, 2007 5:55 pm
Location: SF Bay Area, CA
Contact:

Post by ettore » Mon Jul 16, 2007 8:38 am

I am a little confused.
I would say to please post some code so I can understand what's really going on (and _hopefully_ provide some help :-) ).
ettore pasquini
software engineer
3Dconnexion, inc.

Post Reply