In this article we want to introduce you the new functions from the MBS FileMaker Plugin in version 13.0.
MongoDB
In the last 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 with which you can document the changes. Here we can distinguish between three types of changes. With the function MongoDB.WatchClient we create a stream that documents the changes in the connection. With the function MongoDB.WatchDatabase we create a stream that documents the changes in a database and with the function MongoDB.WatchCollection we list all changes on the collection, which is similar in meaning to a table. A change stream is closed when the MongoDB reference is released, when a new stream has been set or when MongoDB.CloseChangeStream has been explicitly called. The MongoDB.NextChange function iterates over the underlying change stream and returns the next valid JSON document. You can check if there was an error during creation or iteration over a stream with the MongoDB.ChangeStreamErrorDocument. As return of this function you get a JSON with details.
JSON
Also in the JSON topic we got a new function. The JSON.Text function. This function returns us a text that is very readable for humans. The brackets are removed. We get the values with their keys as output. But see yourself. On the left is the JSON we put into the function and on the right is the plain text output.
DynaPDF
In the DynaPDF topic a few new functions have been added: With the function DynaPDF.TestGlyphs you can now check if all characters in the text can be displayed. If all characters of the text can be displayed, we get a -1 as return value. If one or more characters could not be read we get as return a positive number indicating the position of the first missing character. So we can not only check if the text can be displayed, but also where it fails.
The new function DynaPDF.GetPageField Returns the most important properties of a field on a page. Which property we want to get can be specified in the parameters. For example, we can query the field type, the bordercolor or the value itself. The new DynaPDF.GetPageFieldAnnotation function also queries in a similar way. The difference here is that we can use the function with annotation fields.
Also new is the function DynaPDF.CreateICCBasedColorSpace. This function creates an ICC-based color space. ICC-based color spaces (PDF 1.3) are based on a cross-platform color profile as defined by the International Color Consortium (ICC). Unlike the CalGray, CalRGB, and Lab color spaces, which are characterized by entries in the color space dictionary, an ICC-based color space is characterized by a sequence of bytes in a standard format. An ICC profile describes the color characteristics of a particular device and it provides necessary information to convert color data between native device color spaces and device independent color spaces. The ICC specification classifies color devices according to their use as input or output devices such as monitors, scanners, cameras or printers. Depending on the output PDF format different device classes are supported. If the function succeeds the return value is the color space handle. The DynaPDF.CreateICCBasedColorSpaceContainer function does the same but reads the data from a container.
In the functions DynaPDF.ImportPDFFile and DynaPDF.ImportPDFPage we have provided two new optional parameters with which you can adjust the X and Y scaling of the pages that should be imported.
CURL
In the CURL component we have some new functions that I want to present here. The function CURL.SetOptionCACacheTimeout tells libcurl 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. In the parameters the time is given in seconds.
Also new we have the function CURL.SetOptionQuickExit with which we can determine whether an exit quickly is allowed. 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 (though short-lived) leak of associated resources.
We have also added WebSocket support in CURL to our plugin. Compared to HTTP, WebSockets have the advantage that we don't have to send a request to the client for every action between the server and the client, but can exchange information on a open connection. With the function CURL.WebSocketReceive we can receive data over the web socket as JSON. As an optional parameter we can set the buffer size. So we will receive either as much data as the legal buffer size allows or until the buffer is full. If there is more fragment data to deliver than 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. This is how such a JSON may look like:
{ "Offset":11, "BytesLeft":0, "BytesReceived":11, "Flags":2, "FlagText":false, "FlagBinary":true, "FlagContinue":false, "FlagClose":false, "FlagPing":false, "FlagPong":false, "FlagOffset":false, "Data":"48656C6C6F20576F726C64", "Text":"Hello World" }
With the CURL.WebSocketSend function we can Send the specific message fragment over an established WebSocket connection.
With the CURL.SetOptionWebSocketOptions function you can set behavior options for a WebSocket.
Shell
In the Shell section we added two functions Shell.GetTag and Shell.SetTag, with which you can set and query the values of tags. You can use the tag value to associate whatever value you like with the shell object.
Serial Port
Tags also play a big role in the new features in our SerialPort section. Again, we can set any tag with SerialPort.SetTag and query it later with SerialPort.GetTag. Also we have the new function SerialPort.Path with which we can query the path used to open the serial port. Here we only need to specify the appropriate reference in the function to get the path.