Exemplo n.º 1
0
  public HashMap<String, String> rcheck(String msgid) throws IOException {
    if (this.userid == null || this.password == null) {
      System.out.println("setuser required");
      return null;
    }

    HashMap<String, String> map = new HashMap<String, String>();

    map.put("VERSION", VERSION_STR);
    map.put("COMMAND", "CHECK-RESULT");
    if (this.crypt.equals("MD5")) map.put("CRYPT-METHOD", "MD5");
    map.put("AUTH-ID", this.userid);
    map.put("AUTH-PASS", this.password);
    map.put("LANGUAGE", "JAVA");
    map.put("MESSAGE-ID", msgid);

    CSCP cscp = new CSCP();
    cscp.addparam(CSCPPARAM.ID_MESSAGE, TBSP.build(map));
    cscp.build();
    String packet = cscp.getPacketString();
    fos.write(packet.getBytes(), 0, packet.getBytes().length);
    fos.flush();

    CSCP cscp2 = new CSCP();
    cscp2.read(bis);
    CSCPPARAM ack = cscp2.getparam(CSCPPARAM.ID_MESSAGE);
    return TBSP.parse(ack.getBody());
  }
Exemplo n.º 2
0
  /** send all of messages */
  public void send() throws IOException {
    if (this.userid == null || this.password == null) {
      System.out.println("setuser required");
      return;
    }

    for (int i = 0; i < pduList.size(); i++) {
      byte[] packet = assembleFields(pduList.get(i));
      fos.write(packet, 0, packet.length);
      fos.flush();

      CSCP cscp = new CSCP();
      cscp.read(bis);
      CSCPPARAM ack = cscp.getparam(CSCPPARAM.ID_MESSAGE);
      if (ack == null) {
        System.out.println("no ack returned");
        break;
      }
      String tbspstr = ack.getBody();

      HashMap<String, String> map = TBSP.parse(tbspstr);

      result.add(map);
    }
  }
Exemplo n.º 3
0
  public HashMap<String, String> cancelGroup(String groupId) throws IOException {
    if (this.userid == null || this.password == null) {
      System.out.println("setuser required");
      return null;
    }

    byte[] packet = encodeGroupCancel(groupId);
    fos.write(packet, 0, packet.length);
    fos.flush();

    CSCP cscp = new CSCP();
    cscp.read(bis);
    CSCPPARAM ack = cscp.getparam(CSCPPARAM.ID_MESSAGE);
    if (ack == null) {
      System.out.println("no ack returned");
      return null;
    }
    String tbspstr = ack.getBody();
    return TBSP.parse(tbspstr);
  }