Example #1
0
  private List<Add> appendAddConfiguration(Operation operation) throws WindowsOperationException {

    List<Add> addList = new ArrayList<Add>();
    Gson gson = new Gson();

    if (SyncmlCommandType.WIFI.getValue().equals(operation.getCode())) {

      Add add = new Add();

      String operationCode = operation.getCode();

      Wifi wifiObject = gson.fromJson((String) operation.getPayLoad(), Wifi.class);

      String data =
          "&lt;?xml version=&quot;1.0&quot;?&gt;&lt;WLANProfile"
              + "xmlns=&quot;http://www.microsoft.com/networking/WLAN/profile/v1&quot;&gt;&lt;name&gt;"
              + wifiObject.getNetworkName()
              + "&lt;/name&gt;&lt;SSIDConfig&gt;&lt;SSID&gt;&lt;name&gt;"
              + wifiObject.getSsid()
              + "&lt;/name&gt;&lt;/SSID&gt;&lt;/SSIDConfig&gt;&lt;connectionType&gt;"
              + wifiObject.getConnectionType()
              + "&lt;/connectionType&gt;&lt;connectionMode&gt;"
              + wifiObject.getConnectionMode()
              + "&lt;/connectionMode&gt;&lt;MSM&gt;&lt;security&gt;&lt;"
              + "authEncryption&gt;&lt;authentication&gt;"
              + wifiObject.getAuthentication()
              + "&lt;/authentication&gt;&lt;encryption&gt;"
              + wifiObject.getEncryption()
              + "&lt;/encryption&gt;&lt;/authEncryption&gt;&lt;sharedKey&gt;&lt;keyType&gt;"
              + wifiObject.getKeyType()
              + "&lt;/keyType&gt;&lt;protected&gt;"
              + wifiObject.getProtection()
              + "&lt;/protected&gt;&lt;keyMaterial&gt;"
              + wifiObject.getKeyMaterial()
              + "&lt;/keyMaterial&gt;&lt;/sharedKey&gt;&lt;/security&gt;&lt;/MSM&gt;&lt;/WLANProfile&gt;";

      Meta meta = new Meta();
      meta.setFormat("chr");
      List<Item> items = new ArrayList<Item>();

      for (Configure configure : Configure.values()) {
        if (operationCode != null && operationCode.equals(configure.name())) {
          Target target = new Target();
          target.setLocURI(configure.getCode());
          items.get(0).setTarget(target);
        }
      }
      items.get(0).setMeta(meta);
      items.get(0).setData(data);

      add.setCommandId(301);
      add.setItems(items);
      addList.add(add);
      return addList;
    }
    return null;
  }
Example #2
0
 private Item appendGetInfo(Operation operation) {
   Item item = new Item();
   String operationCode = operation.getCode();
   for (Info info : Info.values()) {
     if (operationCode != null && operationCode.equals(info.name())) {
       Target target = new Target();
       target.setLocURI(info.getCode());
       item.setTarget(target);
     }
   }
   return item;
 }
Example #3
0
 private Item appendExecInfo(Operation operation) {
   Item item = new Item();
   String operationCode = operation.getCode();
   for (Command command : Command.values()) {
     if (operationCode != null && operationCode.equals(command.name())) {
       Target target = new Target();
       target.setLocURI(command.getCode());
       item.setTarget(target);
     }
   }
   return item;
 }
Example #4
0
  private void generateHeader() {
    SyncmlHeader sourceHeader = syncmlDocument.getHeader();
    SyncmlHeader header = new SyncmlHeader();
    header.setMsgID(sourceHeader.getMsgID());
    header.setSessionId(sourceHeader.getSessionId());
    Target target = new Target();
    target.setLocURI(sourceHeader.getSource().getLocURI());
    header.setTarget(target);

    Source source = new Source();
    source.setLocURI(sourceHeader.getTarget().getLocURI());
    header.setSource(source);
    replySyncmlDocument.setHeader(header);
  }