« MonkeyBread Software … | Home | Three months until th… »

News from the MBS Xojo Plugins in Version 23.0

In this article I want to introduce you the new functionalities from the MBS Xojo Plugins in version 23.0.

Linux 64-bit for ARM

We added Linux 64-bit plugin support for our plugins.

Please try and let us know if something broke on the way as we plan to improve our support for Linux 64-bit on ARM for the upcoming releases.

As you see on the screenshots, the ChartDirector and Scintilla control works fine.

CURL

In this release we have implemented the WebSocket support in CURL in our plugins. Compared to HTTP, Websockets have the advantage that we don't have to send a request to the client for every action between server and client, but can exchange information on a one-time opened connection. With the method WebSocketReceive from the classes CURLMBS, CURLNMBS and CURLSMBS* we can receive data over the web socket as a suitable CURL(N/S)WebSocketFrameMBS object. Optionally, we can specify the buffersize here to limit the buffer. So we will either receive as much data as the allowed buffersize specifies or until the buffer is full. If there is more fragment data to deliver than from what fits in the provided buffer, CURL returns a full buffer and the application needs to call this function again to continue draining the buffer. The objects of the new classes CURLWebSocketFrameMBS, CURLNWebSocketFrameMBS and CURLSWebSocketFrameMBS* hold some information for us. We can see how big the received package is (BytesReceived) or we can read the data as MemoryBlock. But you can not only receive data, but also send it over to established WebSocket connection with the method WebSocketSend. The method WebSocketMeta queries last frame metadata. The WebSocketOptions property allows you to set behavior options for a WebSocket.

The property OptionCACacheTimeout sets the maximum time any cached certificate store it has in memory may be kept and reused for new connections. Once the timeout has expired, a subsequent fetch requiring a certificate store will have to build a new one. The time is in seconds in the parameters.

The OptionQuickExit property specifies whether exit quickly is possible. That means if we set 1 in the parameters, that when recovering from a timeout, libcurl should skip lengthy cleanups that are intended to avoid all kinds of leaks (threads etc.), as the caller program is about to call exit() anyway. This allows for a swift termination after a DNS timeout for example, by canceling and/or forgetting about a resolver thread, at the expense of a possible leak of associated resources.

We also have two methods from the CURLVersionMBS, CURLNVersionMBS and CURLSVersionMBS* classes. The method FeatureNames queries the feature names and the method Protocols returns an array with the names protocols that libCURL supports.

* CURLS classes with built-in CURL with OpenSSL, CURLN classes with native SSL and CURL classes where you load your own CURL library.

MongoDB

In the last few releases, we have often talked about MongoDB. At the end of last year we added the possibility of transactions. This time we provide new functions for you to document changes. Here we can distinguish between three types of changes. With the Watch method from the MongoClientMBS class we create a stream that documents the changes in the connection. With the Watch method found in the MongoDatabaseMBS class, we create a stream that documents the changes in a database. With the same method, which can also be found in the class MongoCollectionMBS, all changes to the collection, which is roughly equivalent to a table, are listed. In this context we added the new class MongoChangeStreamMBS. An instance of this class is returned by the Watch methods and is used later to read the generated stream with the NextChange method from the new class step by step. A suitable code for documenting the changes in a collection can look like this:

 
Dim pipeline As String = "{}"
Dim stream As MongoChangeStreamMBS = Collection.Watch(pipeline)

// now do inserts

// and now query changes
Dim changeJSON As String

While stream.NextChange(changeJSON)
  
  MessageBox changeJSON
  
Wend 

Tags and Serial Ports

We have added a new property Tag to the ShellMBS class. With it we can set and query tag values. You can use the tag value to associate whatever value you like with the shell object. We have a similar property for the SerialPortMBS class. Here we can use the tag property to specify any custom tag for a SerialPort. This class also has the new function Path which allows you to query the path of the open serial port.

DelegateCrashException

We have the new DelegateCrashExceptionMBS module to help you debug delegates. If something crashes the application, we catch that and raise an exception. To call a delegate that we want to prevent from crashing the whole app, we use the new CallDelegateCrashSafeMBS module. We can catch the following error cases:

  • Invalid pointer access.
  • Invalid instruction
  • Floating point exception
  • Wrong system call
  • Broken pipe
  • Bus error

SVG

With the new class ReSVGMBS we can render vector graphic data to an image. The class uses the ReSVG library which is written in Rust. It has the advantage that it is fast, small and portable and still supports the whole SVG spectrum. Here you can see a script where we load a SVG file from the desktop and display the image as window backdrop in our application.

// we load this file
Dim file As FolderItem = SpecialFolder.Desktop.Child("test.svg")

Dim p As New ReSVGMBS(file)

// and render them in their normal size:
Dim pic As picture = p.RenderToPicture(p.Width, p.Height)

// show in the window
Window1.Backdrop = pic 

XML

Already in 22.4 we introduced the support of XML in your applications with the plugins. Also this release a new class has joined the functionalities. The class XMLDOMParserMBS implements the Document Object Model (DOM) interface. It should be used by applications which choose to parse and process the XML document using the DOM api's. This implementation also allows the applications to install an error and an entity handler (useful extensions to the DOM specification).It can be used to instantiate a validating or non-validating parser, by setting a member flag.

Also new is the NodeFromHandle method from the XMLDocumentMBS class. This method creates an XMLNodeMBS object based on the specified handle

JSON

In the JSONMBS class we have a cool new property Text, that returns us the information of a JSON without brackets, so that it is even better to read for a human.

Barcodes

Barcode In the barcode topic we have added some new properties. In the BarcodeGeneratorMBS class we have added the new property GuardDescent that determins the Height in X-dimensions that EAN/UPC guard bars descend. The property WhitespaceHeight determins the whitespace above and under the barcode. The WarnLevel property is used to set the warning level. It affects error and warning values returned by the Zint API.

New functionalities for Mac and iOS

The MBS Xojo Plugins in version 22.4 offer some more new features for Mac and iOS users.

Core Image filter

We updated our Core Image filter classes for macOS Ventura. This adds 28 new classes to the MacCI Plugin. We have also added numerous properties that provide new input and output options.

DCDevice

The new DCDeviceMBS class for mac and iOS is the representation of a device that provides a unique, authenticated token. We use the shared instance of the DCDevice class to generate a token that identifies a device. Call then the generateToken method to get the token, and send it to the server. On your server, you need to combine the token with an authentication key that you get from the Apple developer program. Then use the result to request access to two per-device binary digits. After authenticating the device, Apple passes the current values of the bits, along with the date they were last modified, to your server. Your server applies its business logic to this information and communicates the results to your app.

App Service

Also new is the SMAppServiceMBS class. We use this class in macOS 13 and later to register and control LoginItems, LaunchAgents, and LaunchDaemons as helper executables for your app.

Save Panel

If you like to save and open files under Mac OS you might come across the NSSavePanelMBS and the NSOpenPanelMBS classes. The NSSavePanelMBS class has got the new methods setTagNames and tagNames. When the value of showsTagField is true, use the setTagNames method to set an array of strings that represent the initial tag names to display in the panel. If you set the property to nil or an empty array, the panel displays no initial tag names. This array can be query by the tagNames method.

New functionalities for Windows users

Last but not least I want to introduce the news for windows users.

Prevent sleep mode

The new class WindowsThreadExecutionStateMBS sets the thread execution state in windows. With this new class, an app can tell the device that it is active, preventing the system from sleeping or turning off the screen while the application is running. The system automatically detects activities such as local keyboard or mouse input, server activity, and changing window focus. Activities that are not automatically detected include hard drive or CPU activity and video display. To make this work properly anyway, this class exists. It does not prevent the user from manually switching to sleep mode or activating the screen saver.

Bluetooth

Our Bluetooth for Windows section has also got new classes. With the new WindowsGattSessionMBS class you can manage a session for a connection to a Bluetooth device. The new class WindowsGattValueChangedEventArgsMBS represents the arguments received by a WindowsGattCharacteristicMBS.ValueChanged event handler used to process characteristic value change notification and indication events sent by a Bluetooth LE device.

Also new is the WindowsGattReadClientCharacteristicConfigurationDescriptorResultMBS class. An object of this class represents the result of reading a GATT Client CharacteristicConfigurationClientDescriptor value. We get such an object from the associated event ReadClientCharacteristicConfigurationDescriptorAsyncCompleted. This is called by the associated new method.

While we are on the topic of events, there are also two new events WriteClientCharacteristicConfigurationDescriptorAsyncCompleted and WriteClientCharacteristicConfigurationDescriptorWithResultAsyncCompleted. These events are called by their matching method.

Besides these new features we have some new methods for the WindowsGattCharacteristicMBS and WindowsGattDeviceServiceMBS classes with which we can query certain values.

We hope you will also find some interesting new features. We wish you a lot of fun with MBS Xojo Plugins version 23.0. If you have any Ideas for new cool features, need a license or have any questions, please contact us.

The biggest plugin in space...
25 01 23 - 08:59