How to find out using the COM interface whether the SpaceMouse is plugged in?

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

Moderator: Moderators

Post Reply
image-instruments
Posts: 6
Joined: Fri Jan 05, 2024 12:52 am

How to find out using the COM interface whether the SpaceMouse is plugged in?

Post by image-instruments »

Hello,
We are currently switching from the old siapp interface to the COM interface.
We program using the C++ Builder.

The following code is executed during initialization:

Code: Select all

  if (!SUCCEEDED(MySD.Connect()))
    ShowMessage("Not Connected");

  if (!MySD.IsConnected)
    ShowMessage("Not Connected");

  if (SUCCEEDED(MySD.get_Sensor(&MySensor)))
    Sensor->ConnectTo (MySensor);

  if (SUCCEEDED(MySD.get_Keyboard(&MyKeyboard)))
    Keyboard->ConnectTo(MyKeyboard);
Unfortunately, the code always runs successfully without a message, even if no SpaceMouse is plugged in.

In the past, the SiGetNumDevices() function returned with 0 and we were able to react to it.
Is there a similar function in the COM interface?
image-instruments
Posts: 6
Joined: Fri Jan 05, 2024 12:52 am

Re: How to find out using the COM interface whether the SpaceMouse is plugged in?

Post by image-instruments »

I may have found the solution to the problem described:
The Type property of the TCOMISimpleDevice object has the following values:
  • 1 if no SaceMouse is connected
  • 50741 when my SaceMouse is connected
I have two questions about this:
  • Can I check for Type <= 1 to recognize that the SpaceMouse is missing?
  • Is there a list of which values Type can have? (I assume 50741 stands for the "SpaceMouse Compact" but I can't find anything about it in the SDK.)
I would be happy to receive an answer!
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: How to find out using the COM interface whether the SpaceMouse is plugged in?

Post by jwick »

It looks like you are using an older COM API that is no longer in maintenance. It probably does work though.

50741d == c635h.
You can find this ProductID in <3DxWinCore>/Cfg/Base.xml:

Code: Select all

    <Device>
      <ID>ID_ProductID_C635</ID>
      <Name>SpaceMouse Compact</Name>
      <VendorID>256f</VendorID>
      <ProductID>c635</ProductID>
In general, we don't want you to do anything special when there is, or is not, a device attached when your app starts. This interrupts hot plugging (user attaches a device later). The driver always tells you there is a device attached, a so-called "NotificationOnly" device if nothing else. If a user attaches a real device later, you will be sent an event of that attachment. But, generally, it will just start working. IOW, your code will just start getting events. There isn't anything you need to do to support this. Also, if multiple devices are attached, the default behavior is to fold all those data streams together and you just see more events coming. This only works if you open the connection to the driver.

You can find out which actual devices are attached by responding to the connection events. We don't encourage it.

That describes the raw API behavior. Ultimately, we really don't want you to even know anything about the attached device(s). It makes it difficult for you to support new devices when we release them.

I assume you are using the device type to do some device-specific assignment/UI. We don't encourage that either. We've moved to a model of having the apps export relevant info to the driver and the driver's GUI does all the programming. This provides a consistent interface to users who use multiple applications.

There is a new API/SDK (v4) that removes all knowledge of input devices and just deals with view changes. We recommend that approach if you are rewriting your interface. It insulates your code from future device changes.

With all that said, the Siapp API you were originally using, is still supported. In fact, it is beneath everything built on top. It is, though, somewhat device-specific. Thus, why we encourage developers to move away from it.
image-instruments
Posts: 6
Joined: Fri Jan 05, 2024 12:52 am

Re: How to find out using the COM interface whether the SpaceMouse is plugged in?

Post by image-instruments »

Hello jwick!
Thank you very much for your detailed answer! It has helped me to understand the concept and the aims of 3Dconnexion. :)
I have now noticed that we are not using the API/SDK at all: We have imported the TDxInput.dll from the installation as an ActiveX control and use these COM objects.

You wrote:
There is a new API/SDK (v4) that removes all knowledge of input devices and just deals with view changes. We recommend that approach if you are rewriting your interface. It insulates your code from future device changes.
We develop with the Embarcadero C++ Builder, unfortunately we see no possibility to use the API/SDK with this. Or do you know of one?
It is a pity that 3Dconnextion does not support this IDE, we alone generate with our program (20k+ installations worldwide) with the support of the SpaceMouse some sales for you.
We are currently thinking about creating a DLL with Visual C++ that exports the API/SDK functions we need. But this is really not an smart way. :?

You wrote:
With all that said, the Siapp API you were originally using, is still supported. In fact, it is beneath everything built on top.
We are using a very old version of Siapp API (our siapp.c has version 1.3 von 2001/01/16). Is a newer version available? It is not included in the current API/SDK, where can we download a newer version?
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: How to find out using the COM interface whether the SpaceMouse is plugged in?

Post by jwick »

There may be samples of using the new SDK with COM in the SDK. It is a substantial change in how you think about accessing the 3D mouse.

If you send an email to our apisupport windows email address (I don't want to put the email address here), someone will send you a link to the "old SDK". software-developer-program page
image-instruments
Posts: 6
Joined: Fri Jan 05, 2024 12:52 am

Re: How to find out using the COM interface whether the SpaceMouse is plugged in?

Post by image-instruments »

jwick wrote: Thu Jan 11, 2024 1:38 am There may be samples of using the new SDK with COM in the SDK. It is a substantial change in how you think about accessing the 3D mouse.
We took a look at this and realized that the entire 3D control is to be taken over by the SDK.
The scene design, object movement and camera control have been implemented in our software for many years and can also be operated without SpaceMouse. The new SDK may be good for developers who are beginning to implement an new application.
For us, the SpaceMouse is a mouse with six directions of movement, which is a very cool feature in itself! :-)
jwick wrote: Thu Jan 11, 2024 1:38 am If you send an email to our apisupport windows email address (I don't want to put the email address here), someone will send you a link to the "old SDK". software-developer-program page
I have logged in there, but unfortunately I cannot find the "apisupport windows email address" there. I have now sent a request to support.
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: How to find out using the COM interface whether the SpaceMouse is plugged in?

Post by jwick »

Yes, it would be a big change, especially if you have already functioning code.

I've sent a link to the "old SDK" from the api support email. It should not have changed much, even since 2005. It does contain support for multiple devices and hot plugging that the COM interface doesn't expose.

I wouldn't switch to the (deprecated) COM interface if you didn't need to. Why did you want to switch?
image-instruments
Posts: 6
Joined: Fri Jan 05, 2024 12:52 am

Re: How to find out using the COM interface whether the SpaceMouse is plugged in?

Post by image-instruments »

jwick wrote: Fri Jan 12, 2024 1:12 am I wouldn't switch to the (deprecated) COM interface if you didn't need to. Why did you want to switch?
We had the impression that support for the Siapp API would be ending. We wanted to be prepared for this. (Many of our customers use the SpaceMouse)
After the conversation here, we'll probably be remaining at the Siapp API.

Thank you for the old SDK. :D
When I replaced my old version with this newer one, I realised that the directory \lib\siapp\ not included.
In particular, we are miss the siapp.c file for creating our program modules.
Could you send me this or all files from \lib\siapp\?

Many thanks for your efforts!
evera@inescop.es
Posts: 1
Joined: Thu Feb 22, 2024 5:17 am

Re: How to find out using the COM interface whether the SpaceMouse is plugged in?

Post by evera@inescop.es »

Hello jwick!!

We have a similar problem that we need to solve. We develop software with Embarcadero C++ Builder and we have integrated 3Dconnexion SpaceMouse using the Siapp API.

For some time now it is not possible to configure the buttons. When trying, 3DConnections settings fails showing the error like the image attached.

We thought that updating the SDK could solve the problem, but we can see that version 4 does not include Siapp API. How could we get the latest version that includes Siapp API?

Thanks a lot
Attachments
Error.jpg
Error.jpg (75.29 KiB) Viewed 8215 times
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: How to find out using the COM interface whether the SpaceMouse is plugged in?

Post by jwick »

Hello,

This may not be an SDK problem. The "old" SDK hasn't changed in many years.

Can you please contact developer support? We'd like to see some files surrounding this error.
You probably need to join the Developer Program to access developer support page.

Thanks.
Jim
Post Reply