TMS iCL native iOS peer 2 peer communication

Friday, August 22, 2014

We've created a short (8 minute) presentation / demo video to show you how our newest native iOS peer 2 peer communication component in TMS iCL works. It shows how you can send an object and text via Bluetooth or local WiFi to nearby peers. Underlying, everything is done via 100% native iOS APIs, so, no Indy or other libraries are being used.

Check out the video here:


Bruno Fierens


Bookmarks: 

This blog post has received 1 comment. Add a comment.



Get device independent, put your settings in the iCloud

Thursday, February 06, 2014

On the road, we carry a smartphone, in a couch we grab the tablet and in the office we sit behind the desk and use a desktop computer. In all scenarios though, we want to use applications that give us access to the same data and functions. Therefore, it is also logical that when we change our parameters for access to this data and functions via the desktop machine application, these same parameters and settings will be reflected (automatically) when we use the smartphone or tablet specific application and vice versa. In the Apple world, the answer to this scenario is persisting our parameters / settings on the iCloud.

As a Delphi developer, we typically like it when we can persist this information with a minimum amount of code so we can focus on the business logic instead of all technical complexities of using the iCloud. Delivering this promise, we've now released two new non-visual components: TTMSFMXNativeiCloud and TTMSFMXNativeMaciCloud. With these components, putting key/value pairs on the iCloud and retrieving them becomes as simple as using a method
 procedure AddKey(AKeyName: String; AKeyValue: TValue);
to create a key/value pair and using the property:
 
 property KeyValues[AKeyName: String]: TValue
to get and set the value of the key.

So, when in one application, the user would change a setting, this can be done with:
var
  FName: strring;

FName := 'TMS';
TMSFMXNativeiCloud.KeyValues['MyAmount'] := 1234;
TMSFMXNativeiCloud.KeyValues['MyName'] := FName;
Thanks to the magic of the iCloud and these non-visual components, the key/value pairs will now automagically be synchronised between applications on different devices coupled to the same iCloud account. If the app wants to react immediately to iCloud pushed value changes, the event TTMSFMXNativeiCloud.OnKeyUpdate is triggered and can be handled like:
procedure TMSFMXNativeiCloud.KeyUpdate(Sender: TObject; AKeyName: String; APreviousValue, ACurrentValue: TValue);
begin
   if (AKeyName = 'MyName') then
     FName := ACurrentValue;
end;
Note that the value is of the type TValue and supports strings, booleans, integers, double and a TMemoryStream. Of course, the component offers several more options like deleting a key/value pair, programmatically forcing a synchronisation of the values on the iCloud, receiving events when iCloud pushed updates to values etc...

TTMSFMXNativeiCloud is available now in the newest TMS iCL update and TTMSFMXNativeMaciCloud is available now in the newest TMS mCL. A FireMonkey iOS demo in TMS iCL and a FireMonkey Mac OS-X demo in TMS mCL demonstrate this concept by having a customizable set of key/value pairs shared via the iCloud between these applications as shown in the screenshot above.

Bruno Fierens


Bookmarks: 

This blog post has not received any comments yet. Add a comment.



Two lines of code to add QR, UPC, EAN code scanning in iOS Delphi applications

Friday, December 20, 2013

For an internal project, we looked at integrating QR code scanning in an iOS application. As we didn't feel like reinventing the wheel and deal with the complexities of deciphering a QR code, we searched for existing code and after trying out several solutions, found ZBar to be one of the most solid libraries. The project is at : http://zbar.sourceforge.net/

After doing this evaluation in XCode with ObjectiveC, the next duty was to find out how we could use an ObjectiveC library from a Delphi FireMonkey project. There are several important details to pay attention to when doing this, but finally this also proved to work and in the typical Delphi RAD philosophy, we decided to create a wrapper Delphi component for this. With this wrapper component, scanning a QR, UPC or EAN code from Delphi is as simple as two lines of code:

procedure TForm1136.Button1Click(Sender: TObject);
begin
  // line1: activate the code scanner. This shows the camera that should be aimed at the QR or UPC code
  TMSFMXZBarReader1.Show;
end;

procedure TForm1136.TMSFMXZBarReader1GetResult(Sender: TObject;
  AResult: string);
begin
  //line 2: the OnGetResult event is triggered when the code was retrieved and this returns it as a text
  ListBox1.Items.Insert(0, AResult);
end;
You can download the sample project and the package with full source code to install the TTMSFMXZBarReader component here: http://www.tmssoftware.net/public/TMSFMXZBarReader.zip
Open the package file TMSFMXZBarReaderPkgDXE*.dproj from Delphi XE* (* = 5,6,7,8) and compile & install this package. This will add the component TTMSFMXZBarReader on the tool palette. Then you can drop this component in an iOS Delphi appplication and start using it in 1,2, 3 ...

   

Bruno Fierens


Bookmarks: 

This blog post has received 26 comments. Add a comment.



Block Animations with TMS iCL

Wednesday, July 03, 2013

This week, we had a support question on Block Animations with TMS iCL, or in other words, how to animate for example a TTMSFMXNativeUIView?

To be honest, after all the hard work around the TMS iCL components, demos and documentation there wasn't room left for some more diving inside the iOS frameworks and features, so we couldn't really answer YES to the question until it was sorted out if it was even possible. When we got the question about Block Animations we were really curious if it would actually do anything since we are not working directly in XCode with the native language. So we dropped everything and started testing.

It was clear that even this feature of the iOS core animation framework would work as expected without any issues. We dropped a TTMSFMXNativeUIView instance on the form, dropped a button with the following code:
TUIView.OCClass.beginAnimations(nil, nil);  
TUIView.OCClass.setAnimationDuration(0.4);  
TMSFMXNativeUIView1.SetBounds(0, 0, 320, 480);  
TUIView.OCClass.commitAnimations;  
and some initialization to position the view out of sight:
TMSFMXNativeUIView1.SetBounds(0, 480, 320, 480); 
Starting the application and clicking the button slides the view in from the bottom.

This is only a basic animation and in the documentation of Block Animations there were some more complex samples such as animating the alpha of a component and the animation curve. The next sample animates a flip on the view and shows a second view:
var
  vwRemove, vwAdd: TTMSFMXNativeUIView;
begin
  vwRemove := nil;
  vwAdd := nil;
  if Assigned(TMSFMXNativeUIView1.Parent) then
  begin
    vwRemove := TMSFMXNativeUIView1;
    vwAdd := TMSFMXNativeUIView2;
  end
  else if Assigned(TMSFMXNativeUIView2.Parent) then
  begin
    vwRemove := TMSFMXNativeUIView2;
    vwAdd := TMSFMXNativeUIView1;
  end;

  if Assigned(vwRemove) and Assigned(vwAdd) then
  begin
    TUIView.OCClass.beginAnimations(nil, nil);
    TUIView.OCClass.setAnimationTransition(UIViewAnimationTransitionFlipFromLeft, TMSFMXNativeUIView3.View, False);
    TUIView.OCClass.setAnimationCurve(UIViewAnimationCurveEaseIn);
    TUIView.OCClass.setAnimationDuration(0.8);
    vwRemove.Parent := nil;
    vwAdd.Parent := TMSFMXNativeUIView3;
    TUIView.OCClass.commitAnimations
  end;
end;
The demo for this code can be found at the following link:
http://www.tmssoftware.net/public/FlipDemo.zip


Pieter Scheldeman


Bookmarks: 

This blog post has not received any comments yet. Add a comment.



TMS iCL on iOS7

Tuesday, June 11, 2013

Curious as we are, we wanted to test out our TMS iCL native iOS controls for FireMonkey today on the beta of iOS7 that was released yesterday at WWDC 2013.
While there are some glitches with debugging, mainly due to the Delphi XE4 debugger itself, the good news is that our TMS iCL controls not only work smooth on iOS 7 but also adopt the new look & feel and new behaviors. The FireMonkey application using TMS iCL installed on iOS 6 adopts the iOS 6 look & feel while the same application deployed on iOS adopts the new iOS 7 look & feel.
Stay tuned.

Bruno Fierens


Bookmarks: 

This blog post has received 5 comments. Add a comment.




Previous  |  Next  |  Index