///////////////////////////////////////////////////////////////////////////////
//
// Copyright 1997 Telelogic AB
// All rights reserved.
// No part of this document or computer program may be reproduced,
// transmitted, transcribed, or translated into any language in any form by
// any means without prior written permission of Telelogic AB, in accordance
// with the terms and conditions stipulated in the agreement or contract under
// wich the program(s) have been supplied. Information in this document or
// computer program is subject to change without notice.
//
///////////////////////////////////////////////////////////////////////////////

class postmaster {

  // Tools and signals
  final int SET_SDLENV = 27000;
  final int SESDLSIGNAL = 26001;
  final int SESTOPNOTIFY = 3003;

  // Return values from functions
  final int SPOK = 0;
  final int SPERROR = -1;

  // Timeout to wait indefinitely for a message
  final int SPWAITFOREVER = -1;

  // Service reply codes
  final int SDT_OK = 0;
  final int SDT_BUSY = 1;
  final int SDT_ERRSTR = 2;
  final int SDT_ERRCODE = 3;

  // Latest values from Read
  int Sender = 0;
  int Message = 0;
  String Data = "";

  public native int Init(int toolType);
  public native int SendToTool(int toolType, int message, String data);
  public native int SendToPid(int pId, int message, String data);
  public native int Broadcast(int message, String data);
  public native int Read(int timeOut);
  public native int Exit();
  
  private void ReadCallback(int sender, int message, String data) {
    Sender = sender;
    Message = message;
    Data = data;
  }

  static {
    System.loadLibrary("libsdtpost");
  }
}




