Platforms to show: All Mac Windows Linux Cross-Platform

Back to UniMotionMBS module.

UniMotionMBS.DetectSMS as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Sudden Motion Sensor MBS MacOSX Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the value of SMS hardware present or unknown if no hardware is detected.
Example
dim type as Integer = UniMotionMBS.DetectSMS

if type=0 then
MsgBox "Unknown motion hardware or none found."
quit
end if

Use the constants powerbook, ibook, highrespb and macbookpro.

Use the value returned from DetectSMS as the type for the other functions.
Don't call readsms(detectsms...) as this will do extra work.
If you can't save the type between calls pass 0 as type to avoid extra work.

UniMotionMBS.LoadLibrary(file as folderitem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Sudden Motion Sensor MBS MacOSX Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Loads the library from the folderitem.
Example
dim f as FolderItem

f=GetFolderItem("libUniMotion.dylib")
if UniMotionMBS.LoadLibrary(f) then
'ok
MainWindow.Show
else
MsgBox "Failed to load the UniMotion library."
quit
end if

Returns true on success and false on failure.

UniMotionMBS.ReadSMS(type as Integer, byref x as Integer, byref y as Integer, byref z as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Sudden Motion Sensor MBS MacOSX Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Reads the "calibrated" values (same as raw if no calibration data exists)

Returns true on success and false on failure.

UniMotionMBS.ReadSMSraw(type as Integer, byref x as Integer, byref y as Integer, byref z as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Sudden Motion Sensor MBS MacOSX Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Reads the raw, unmodified values.

Returns true on success and false on failure.

UniMotionMBS.ReadSMSrawBytes(type as Integer) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Sudden Motion Sensor MBS MacOSX Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Reads the raw data bytes.

The raw SMS data (useful for debugging)
Note that endian issues make reading the raw bytes non-trivial.
Returns nil or a memoryblock with the data.

UniMotionMBS.ReadSMSreal(type as Integer, byref x as Double, byref y as Double, byref z as Double) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Sudden Motion Sensor MBS MacOSX Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Reads the real (1.0 = 1G) values (requires calibration data).

Note that this is the preferred API as it need not change with new machines.
If no "scale" calibration data exists defaults will be used based on the machine type.

Returns true on success and false on failure.

UniMotionMBS.ReadSMSscaled(type as Integer, byref x as Integer, byref y as Integer, byref z as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Sudden Motion Sensor MBS MacOSX Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the scaled values, like real but easier to handle.

This reverses the backwards polarity of x and increases the range of the older machines to match the MacBook [Pro] sensor.

Returns true on success and false on failure.

The items on this page are in the following plugins: MBS MacOSX Plugin.


The biggest plugin in space...