Step 4 : ARM 4.0 C Hello World example

Description

Having registered our application and transaction data we can start the application instance:

  1. For starting an ARM application we need an application start handle. This handle is used in any subsequent call to reference this particular application instance:
    arm_app_start_handle_t app_handle;
  2. Now we can start our application instance with the arm_start_application() call. We pass the following parameters:
    1. pointer to application ID under which the application was previously registered.
    2. a name describing the group of the application (please see the standard document for ARM 4.0).
    3. A NULL string for the application instance context property.
    4. ARM_FLAG_NONE - there are no flags defined for this API call.
    5. ARM_BUF4_NONE - it is a simple example, so no optional data is passed.
    6. pointer to our app_handle variable where the agent stores the application start handle for our instance.

Code

01: #include <stdio.h>
02: #include "arm4.h"
03: 
04: int main(int argc, char *argv[])
05: {   
06:    arm_id_t app_id;
07:    arm_id_t tran_id;
08:    arm_app_start_handle_t app_handle;
09:    arm_register_application("HelloWorldApp", ARM_ID_NONE,
10:                              ARM_FLAG_NONE, ARM_BUF4_NONE,
11:                              &app_id);
12:    arm_register_transaction(&app_id, "HelloWorldTran", ARM_ID_NONE,
13:                              ARM_FLAG_NONE, ARM_BUF4_NONE,
14:                              &tran_id);
15:    arm_start_application(&app_id, "Tutorial", NULL,
16:                           ARM_FLAG_NONE, ARM_BUF4_NONE,
17:                           &app_handle);
18:    printf("Hello world!\n");
19:    return 0;
20: }