Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TMS LCL Cloud Pack
Using TMS LCL Components for Raspberry Pi
Using TMS LCL Components for Raspberry Pi
With the recently introduced TMS LCL Cloud Pack and the open-source TMS LCL HW Pack, building small Raspberry Pi based projects is easier than ever. In this example, the code for an appliance is presented that displays the number of visitors on a website on a Raspberry Pi 16x2 LCD backpanel.
This code fetches the page statistics from Google Analytics with the TMS LCL Cloud Pack TMSLCLCloudGAnalytics component
function TForm1.GetRTVisitors: string; var RT: TRealtimeMetricsArray; StartDate, EndDate: string; i: integer; error: string; Res: TGStringArray; begin Result := ‘’; StartDate := ''today''; EndDate := ''today''; SetLength(RT,1); RT[0] := rtActiveUsers; TMSLCLCloudGAnalytics1.RequestData.RealtimeMetrics := RT; // fetches data for the page coupled with Google Analytics ID set via ViewID Error := TMSLCLCloudGAnalytics1.GetData(TMSLCLCloudGAnalytics1.App.ViewID); If Error = ‘’ then begin Res := TMSLCLCloudGAnalytics1.Data.Data[0]; Result := Res[0]; end; end;
procedure TForm1.ButtonClick1 (Sender: TObject); begin TMSLCLAdaDispl16x2.Init; TMSLCLCloudGAnalytics1.Connect; end;
procedure TForm1.TMSLCLCloudGAnalytics1Connected(Sender: TObject); var s: string; begin s := GetRTVisitors; TMSLCLAdaDispl16x2.DrawText(‘Visitors:’ +s); end;