IPDL/Five minute example: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
Line 5: Line 5:
Put this in the file <code>ipc/ipdl/test-harness/Test.ipdl</code>.
Put this in the file <code>ipc/ipdl/test-harness/Test.ipdl</code>.


  sync protocol Test
sync protocol Test
  {
{
  both:
both:
      sync Ping() returns (int status);
    sync Ping() returns (int status);
 
  parent:
parent:
      GetValue(String key);
    GetValue(String key);
      GetValues(StringArray keys);
    GetValues(StringArray keys);
      sync SetValue(String key, String val) returns (bool ok);
    sync SetValue(String key, String val) returns (bool ok);
 
  child:
child:
      TellValue(String key, String val);
    TellValue(String key, String val);
      TellValues(StringArray keys, StringArray vals);
    TellValues(StringArray keys, StringArray vals);
 
  state START:
state START:
      recv Ping goto START;
    recv Ping goto START;
      send Ping goto START;
    send Ping goto START;
 
      recv SetValue goto HAVE_VALUES;
    recv SetValue goto HAVE_VALUES;
 
  state HAVE_VALUES:
state HAVE_VALUES:
      recv Ping goto HAVE_VALUES;
    recv Ping goto HAVE_VALUES;
      send Ping goto HAVE_VALUES;
    send Ping goto HAVE_VALUES;
 
      recv SetValue goto HAVE_VALUES;
    recv SetValue goto HAVE_VALUES;
 
      recv GetValue goto TELLING_VALUE;
    recv GetValue goto TELLING_VALUE;
      recv GetValues goto TELLING_VALUES;
    recv GetValues goto TELLING_VALUES;
 
  state TELLING_VALUE:
state TELLING_VALUE:
      send TellValue goto HAVE_VALUES;
    send TellValue goto HAVE_VALUES;
  state TELLING_VALUES:
state TELLING_VALUES:
      send TellValues goto HAVE_VALUES;
    send TellValues goto HAVE_VALUES;
  };
};


== Hook the IPDL file into our build system ==
== Hook the IPDL file into our build system ==
Line 45: Line 45:
* Create the file <code>ipc/ipdl/test-harness/ipdl.mk</code> and add the following text to it.
* Create the file <code>ipc/ipdl/test-harness/ipdl.mk</code> and add the following text to it.


  IPDLSRCS = \
IPDLSRCS = \
    Test.ipdl \
  Test.ipdl \
    $(NULL)
  $(NULL)
Confirmed users
699

edits