org.tizen.injector.nfc_1.0.0.201310291329

16:50:06.450 INFO  jd.cli.Main - Decompiling org.tizen.injector.nfc_1.0.0.201310291329.jar
package org.tizen.injector.nfc;

import org.tizen.injector.nfc.page.NfcPage;
import org.tizen.injector.provider.AbstractInjectorItem;

public class Nfc
  extends AbstractInjectorItem
{
  protected void addPages()
  {
    addPage(new NfcPage(this, "NFC"));
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.Nfc
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import java.util.ArrayList;
import java.util.Iterator;

class MimeTypeList
{
  private static MimeTypeList typelist = new MimeTypeList();
  private ArrayList<NfcMimeType> list = new ArrayList();
  
  public static MimeTypeList getInstance()
  {
    return typelist;
  }
  
  private MimeTypeList()
  {
    list.add(new NfcMimeType("vcf", "application/vcard"));
    list.add(new NfcMimeType("jpeg", "image/jpeg"));
    list.add(new NfcMimeType("mpeg", "image/mpeg"));
    list.add(new NfcMimeType("png", "image/png"));
    list.add(new NfcMimeType("gif", "image/gif"));
    list.add(new NfcMimeType("bmp", "image/bmp"));
    list.add(new NfcMimeType("jpg", "image/jpeg"));
    list.add(new NfcMimeType("jpe", "image/jpeg"));
    list.add(new NfcMimeType("mp3", "audio/mpeg"));
    list.add(new NfcMimeType("mid", "audio/midi"));
    list.add(new NfcMimeType("wav", "audio/x-wav"));
    list.add(new NfcMimeType("mp4", "video/mp4"));
    list.add(new NfcMimeType("mpe", "video/mpeg"));
    list.add(new NfcMimeType("mpg", "video/mpeg"));
    list.add(new NfcMimeType("mov", "video/quicktime"));
    list.add(new NfcMimeType("flv", "video/x-flv"));
    list.add(new NfcMimeType("asf", "video/x-ms-asf"));
    list.add(new NfcMimeType("avi", "video/x-msvideo"));
  }
  
  public String findMimeType(String paramString)
  {
    Iterator localIterator = list.iterator();
    while (localIterator.hasNext())
    {
      NfcMimeType localNfcMimeType = (NfcMimeType)localIterator.next();
      if (localNfcMimeType.getExtension().equals(paramString)) {
        return localNfcMimeType.getMimetype();
      }
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.MimeTypeList
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

public class NDEFRecord
{
  private int format = 0;
  private String typename = null;
  private String id = null;
  private String payload = null;
  
  public NDEFRecord() {}
  
  public NDEFRecord(int paramInt, String paramString1, String paramString2, String paramString3)
  {
    setFormat(paramInt);
    setTypeName(paramString1);
    setId(paramString2);
    setPayload(paramString3);
  }
  
  public int getFormat()
  {
    return format;
  }
  
  public void setFormat(int paramInt)
  {
    format = paramInt;
  }
  
  public String getTypeName()
  {
    return typename;
  }
  
  public void setTypeName(String paramString)
  {
    typename = paramString;
  }
  
  public String getId()
  {
    return id;
  }
  
  public void setId(String paramString)
  {
    id = paramString;
  }
  
  public String getPayload()
  {
    return payload;
  }
  
  public void setPayload(String paramString)
  {
    payload = paramString;
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecord
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class NDEFRecordPage$1
  extends SelectionAdapter
{
  NDEFRecordPage$1(NDEFRecordPage paramNDEFRecordPage) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    NDEFRecordPage.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecordPage.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class NDEFRecordPage$2
  extends SelectionAdapter
{
  NDEFRecordPage$2(NDEFRecordPage paramNDEFRecordPage) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    NDEFRecordPage.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecordPage.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class NDEFRecordPage$3
  extends SelectionAdapter
{
  NDEFRecordPage$3(NDEFRecordPage paramNDEFRecordPage) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    NDEFRecordPage.access$2(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecordPage.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class NDEFRecordPage$4
  extends SelectionAdapter
{
  NDEFRecordPage$4(NDEFRecordPage paramNDEFRecordPage) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    NDEFRecordPage.access$3(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecordPage.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Text;

class NDEFRecordPage$5
  extends SelectionAdapter
{
  NDEFRecordPage$5(NDEFRecordPage paramNDEFRecordPage) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    Selected(paramSelectionEvent);
  }
  
  public void widgetDefaultSelected(SelectionEvent paramSelectionEvent)
  {
    Selected(paramSelectionEvent);
  }
  
  private void Selected(SelectionEvent paramSelectionEvent)
  {
    int i = NDEFRecordPage.access$4(this$0).getSelectionIndex();
    if (i != -1)
    {
      NDEFRecordPage.access$5(this$0, i);
      NDEFRecordPage.access$6(this$0).setText("");
      NDEFRecordPage.access$7(this$0).select(0);
      NDEFRecordPage.access$8(this$0).setText("");
      NDEFRecordPage.access$9(this$0).setText("");
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecordPage.5
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Text;

class NDEFRecordPage$6
  implements ModifyListener
{
  NDEFRecordPage$6(NDEFRecordPage paramNDEFRecordPage) {}
  
  public void modifyText(ModifyEvent paramModifyEvent)
  {
    if (!NDEFRecordPage.access$10(this$0))
    {
      NDEFRecordPage.access$11(this$0, true);
      return;
    }
    if (!NDEFRecordPage.access$12(this$0).checkInvalidCharaters(NDEFRecordPage.access$6(this$0).getText()))
    {
      NDEFRecordPage.access$6(this$0).setText(NDEFRecordPage.access$13(this$0).getTypeName());
      return;
    }
    NDEFRecordPage.access$13(this$0).setTypeName(NDEFRecordPage.access$6(this$0).getText());
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecordPage.6
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Text;

class NDEFRecordPage$7
  implements ModifyListener
{
  NDEFRecordPage$7(NDEFRecordPage paramNDEFRecordPage) {}
  
  public void modifyText(ModifyEvent paramModifyEvent)
  {
    if (!NDEFRecordPage.access$14(this$0))
    {
      NDEFRecordPage.access$15(this$0, true);
      return;
    }
    if (!NDEFRecordPage.access$12(this$0).checkInvalidCharaters(NDEFRecordPage.access$8(this$0).getText()))
    {
      NDEFRecordPage.access$8(this$0).setText(NDEFRecordPage.access$13(this$0).getId());
      return;
    }
    NDEFRecordPage.access$13(this$0).setId(NDEFRecordPage.access$8(this$0).getText());
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecordPage.7
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Text;

class NDEFRecordPage$8
  implements ModifyListener
{
  NDEFRecordPage$8(NDEFRecordPage paramNDEFRecordPage) {}
  
  public void modifyText(ModifyEvent paramModifyEvent)
  {
    if (!NDEFRecordPage.access$16(this$0))
    {
      NDEFRecordPage.access$17(this$0, true);
      return;
    }
    if (!NDEFRecordPage.access$12(this$0).checkInvalidCharaters(NDEFRecordPage.access$9(this$0).getText()))
    {
      NDEFRecordPage.access$9(this$0).setText(NDEFRecordPage.access$13(this$0).getPayload());
      return;
    }
    NDEFRecordPage.access$13(this$0).setPayload(NDEFRecordPage.access$9(this$0).getText());
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecordPage.8
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Text;

class NDEFRecordPage$9
  extends SelectionAdapter
{
  NDEFRecordPage$9(NDEFRecordPage paramNDEFRecordPage) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    String str = NDEFRecordPage.access$12(this$0).selectMediaFile(NDEFRecordPage.access$18(this$0));
    if (str != null)
    {
      NDEFRecordPage.access$6(this$0).setEnabled(true);
      NDEFRecordPage.access$6(this$0).setEditable(false);
      NDEFRecordPage.access$9(this$0).setEnabled(true);
      NDEFRecordPage.access$9(this$0).setEditable(false);
      NDEFRecordPage.access$6(this$0).setText(NDEFRecordPage.access$12(this$0).checkFileType(str));
      NDEFRecordPage.access$9(this$0).setText(str);
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecordPage.9
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import java.util.ArrayList;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.tizen.injector.util.FormPageUtil;
import org.tizen.sdblib.IDevice;

public class NDEFRecordPage
{
  private String[] RecordFormatList = RecordFormat.getInstance().getList();
  private String[] TypeNameList = TypeName.getInstance().getList();
  private Combo cmbRecordFormat;
  private Combo cmbRecordTypeName;
  private Text txtRecordTypeName;
  private Text txtRecordID;
  private Text txtRecordPayload;
  private Button butSelectMediaFile;
  private Button butRecordAdd;
  private Button butRecordEdit;
  private Button butRecordRemove;
  private Label lblRecords;
  private int nTotalLength = 0;
  private final int nMaxNDFEMessageLength = 4096;
  private Combo cmbRecordList;
  private ArrayList<NDEFRecord> RecordList = new ArrayList();
  private NDEFRecord oldRecord = new NDEFRecord(0, "", "", "");
  private boolean bCheckTypeNameText = true;
  private boolean bCheckIDText = true;
  private boolean bCheckPayloadText = true;
  private NfcHelpProcess process = null;
  private Shell shell;
  private IDevice currentDevice = null;
  
  public NDEFRecordPage(Shell paramShell)
  {
    process = new NfcHelpProcess(paramShell);
    shell = paramShell;
  }
  
  public void createNDEFMessageSection(FormPageUtil paramFormPageUtil, Composite paramComposite)
  {
    Composite localComposite1 = paramFormPageUtil.createSection(paramComposite, "NDEF Message");
    Composite localComposite2 = paramFormPageUtil.createComposite(localComposite1);
    createRecordComposite(paramFormPageUtil, localComposite2);
    Composite localComposite3 = paramFormPageUtil.createComposite(localComposite2, 3);
    butRecordAdd = paramFormPageUtil.createButton(localComposite3, "Add", 8);
    butRecordEdit = paramFormPageUtil.createButton(localComposite3, "Edit", 8);
    butRecordRemove = paramFormPageUtil.createButton(localComposite3, "Remove", 8);
    GridData localGridData1 = new GridData();
    widthHint = 110;
    butRecordAdd.setLayoutData(localGridData1);
    butRecordEdit.setLayoutData(localGridData1);
    butRecordRemove.setLayoutData(localGridData1);
    butRecordAdd.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent paramAnonymousSelectionEvent)
      {
        NDEFRecordPage.this.addRecord();
      }
    });
    butRecordEdit.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent paramAnonymousSelectionEvent)
      {
        NDEFRecordPage.this.editRecord();
      }
    });
    butRecordRemove.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent paramAnonymousSelectionEvent)
      {
        NDEFRecordPage.this.removeRecord();
      }
    });
    Composite localComposite4 = paramFormPageUtil.createComposite(localComposite2, 2);
    GridData localGridData2 = new GridData();
    widthHint = 160;
    lblRecords = paramFormPageUtil.createLabel(localComposite4, String.format("Records [0/%d] ", new Object[] { Integer.valueOf(4096) }));
    lblRecords.setLayoutData(localGridData2);
    cmbRecordList = paramFormPageUtil.createCombo(localComposite4);
    cmbRecordList.setLayoutData(localGridData2);
    cmbRecordList.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent paramAnonymousSelectionEvent)
      {
        NDEFRecordPage.this.selectRecord();
      }
    });
  }
  
  private void createRecordComposite(FormPageUtil paramFormPageUtil, Composite paramComposite)
  {
    GridData localGridData = new GridData();
    widthHint = 200;
    Composite localComposite = paramFormPageUtil.createComposite(paramComposite, 2);
    paramFormPageUtil.createLabel(localComposite, "Type Name Format ");
    cmbRecordFormat = paramFormPageUtil.createCombo(localComposite);
    cmbRecordFormat.setLayoutData(localGridData);
    paramFormPageUtil.addComboItem(cmbRecordFormat, RecordFormatList);
    paramFormPageUtil.createLabel(localComposite, "Type Name ");
    txtRecordTypeName = paramFormPageUtil.createText(localComposite, "");
    txtRecordTypeName.setLayoutData(localGridData);
    txtRecordTypeName.setTextLimit(250);
    paramFormPageUtil.createLabel(localComposite, "");
    cmbRecordTypeName = paramFormPageUtil.createCombo(localComposite);
    paramFormPageUtil.addComboItem(cmbRecordTypeName, TypeNameList);
    cmbRecordTypeName.setLayoutData(localGridData);
    paramFormPageUtil.createLabel(localComposite, "ID ");
    txtRecordID = paramFormPageUtil.createText(localComposite, "");
    txtRecordID.setLayoutData(localGridData);
    txtRecordID.setTextLimit(250);
    paramFormPageUtil.createLabel(localComposite, "Payload ");
    txtRecordPayload = paramFormPageUtil.createText(localComposite, "");
    txtRecordPayload.setLayoutData(localGridData);
    txtRecordPayload.setTextLimit(1024);
    paramFormPageUtil.createLabel(localComposite, "");
    butSelectMediaFile = paramFormPageUtil.createButton(localComposite, "Select Media File", 8);
    butSelectMediaFile.setEnabled(false);
    butSelectMediaFile.setLayoutData(new GridData(3, 3, false, false));
    checkRecordFormat(0);
    addListener();
  }
  
  private void addListener()
  {
    cmbRecordFormat.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent paramAnonymousSelectionEvent)
      {
        Selected(paramAnonymousSelectionEvent);
      }
      
      public void widgetDefaultSelected(SelectionEvent paramAnonymousSelectionEvent)
      {
        Selected(paramAnonymousSelectionEvent);
      }
      
      private void Selected(SelectionEvent paramAnonymousSelectionEvent)
      {
        int i = cmbRecordFormat.getSelectionIndex();
        if (i != -1)
        {
          NDEFRecordPage.this.checkRecordFormat(i);
          txtRecordTypeName.setText("");
          cmbRecordTypeName.select(0);
          txtRecordID.setText("");
          txtRecordPayload.setText("");
        }
      }
    });
    txtRecordTypeName.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent paramAnonymousModifyEvent)
      {
        if (!bCheckTypeNameText)
        {
          bCheckTypeNameText = true;
          return;
        }
        if (!process.checkInvalidCharaters(txtRecordTypeName.getText()))
        {
          txtRecordTypeName.setText(oldRecord.getTypeName());
          return;
        }
        oldRecord.setTypeName(txtRecordTypeName.getText());
      }
    });
    txtRecordID.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent paramAnonymousModifyEvent)
      {
        if (!bCheckIDText)
        {
          bCheckIDText = true;
          return;
        }
        if (!process.checkInvalidCharaters(txtRecordID.getText()))
        {
          txtRecordID.setText(oldRecord.getId());
          return;
        }
        oldRecord.setId(txtRecordID.getText());
      }
    });
    txtRecordPayload.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent paramAnonymousModifyEvent)
      {
        if (!bCheckPayloadText)
        {
          bCheckPayloadText = true;
          return;
        }
        if (!process.checkInvalidCharaters(txtRecordPayload.getText()))
        {
          txtRecordPayload.setText(oldRecord.getPayload());
          return;
        }
        oldRecord.setPayload(txtRecordPayload.getText());
      }
    });
    butSelectMediaFile.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent paramAnonymousSelectionEvent)
      {
        String str = process.selectMediaFile(currentDevice);
        if (str != null)
        {
          txtRecordTypeName.setEnabled(true);
          txtRecordTypeName.setEditable(false);
          txtRecordPayload.setEnabled(true);
          txtRecordPayload.setEditable(false);
          txtRecordTypeName.setText(process.checkFileType(str));
          txtRecordPayload.setText(str);
        }
      }
    });
  }
  
  private void selectRecord()
  {
    int i = cmbRecordList.getSelectionIndex();
    if (i != -1)
    {
      NDEFRecord localNDEFRecord = (NDEFRecord)RecordList.get(i);
      checkRecordFormat(localNDEFRecord.getFormat());
      cmbRecordFormat.select(localNDEFRecord.getFormat());
      if (localNDEFRecord.getFormat() == 1)
      {
        if (localNDEFRecord.getTypeName().compareTo("U") == 0) {
          cmbRecordTypeName.select(0);
        } else {
          cmbRecordTypeName.select(1);
        }
        txtRecordTypeName.setText("");
      }
      else
      {
        cmbRecordTypeName.select(0);
        txtRecordTypeName.setText(localNDEFRecord.getTypeName());
      }
      txtRecordID.setText(localNDEFRecord.getId());
      txtRecordPayload.setText(localNDEFRecord.getPayload());
    }
  }
  
  private void checkRecordFormat(int paramInt)
  {
    switch (paramInt)
    {
    case 0: 
      cmbRecordTypeName.setEnabled(false);
      txtRecordTypeName.setEnabled(false);
      txtRecordID.setEnabled(false);
      txtRecordPayload.setEnabled(false);
      butSelectMediaFile.setEnabled(false);
      break;
    case 1: 
      cmbRecordTypeName.setEnabled(true);
      cmbRecordTypeName.select(0);
      txtRecordTypeName.setEnabled(false);
      txtRecordID.setEnabled(true);
      txtRecordPayload.setEnabled(true);
      txtRecordPayload.setEditable(true);
      butSelectMediaFile.setEnabled(false);
      break;
    case 2: 
      cmbRecordTypeName.setEnabled(false);
      txtRecordTypeName.setEnabled(false);
      txtRecordID.setEnabled(true);
      txtRecordPayload.setEnabled(false);
      butSelectMediaFile.setEnabled(true);
      break;
    case 3: 
      cmbRecordTypeName.setEnabled(false);
      txtRecordTypeName.setEnabled(true);
      txtRecordTypeName.setEditable(true);
      txtRecordID.setEnabled(true);
      txtRecordPayload.setEnabled(false);
      butSelectMediaFile.setEnabled(false);
      break;
    case 4: 
      cmbRecordTypeName.setEnabled(false);
      txtRecordTypeName.setEnabled(true);
      txtRecordTypeName.setEditable(true);
      txtRecordID.setEnabled(true);
      txtRecordPayload.setEnabled(true);
      txtRecordPayload.setEditable(true);
      butSelectMediaFile.setEnabled(false);
      break;
    case 5: 
      cmbRecordTypeName.setEnabled(false);
      txtRecordTypeName.setEnabled(false);
      txtRecordID.setEnabled(true);
      txtRecordPayload.setEnabled(true);
      txtRecordPayload.setEditable(true);
      butSelectMediaFile.setEnabled(false);
      break;
    }
    bCheckTypeNameText = false;
    bCheckIDText = false;
    bCheckPayloadText = false;
  }
  
  private void addRecord()
  {
    if (RecordList.size() >= 5)
    {
      NfcDialog.openInfoDialog(shell, NfcErrorString.RecordCountIsMax);
      return;
    }
    NDEFRecord localNDEFRecord = new NDEFRecord();
    setRecordValue(localNDEFRecord);
    RecordList.add(localNDEFRecord);
    int i = process.checkRecordlistMaxLength(RecordList, 4096);
    if (i == 0)
    {
      RecordList.remove(localNDEFRecord);
      return;
    }
    nTotalLength = i;
    lblRecords.setText(String.format("Records [%4d/%d] ", new Object[] { Integer.valueOf(nTotalLength), Integer.valueOf(4096) }));
    cmbRecordList.add("record item" + RecordList.indexOf(localNDEFRecord));
    cmbRecordList.clearSelection();
  }
  
  private void editRecord()
  {
    int i = cmbRecordList.getSelectionIndex();
    if (i != -1)
    {
      Object localObject1 = (NDEFRecord)RecordList.get(i);
      Object localObject2 = localObject1;
      setRecordValue((NDEFRecord)localObject1);
      int j = process.checkRecordlistMaxLength(RecordList, 4096);
      if (j == 0)
      {
        localObject1 = localObject2;
        return;
      }
      nTotalLength = j;
      lblRecords.setText(String.format("Records [%4d/%d] ", new Object[] { Integer.valueOf(nTotalLength), Integer.valueOf(4096) }));
    }
  }
  
  private void removeRecord()
  {
    int i = cmbRecordList.getSelectionIndex();
    if (i != -1)
    {
      RecordList.remove(i);
      cmbRecordList.removeAll();
      for (int j = 0; j < RecordList.size(); j++) {
        cmbRecordList.add("record item" + j);
      }
      cmbRecordList.clearSelection();
    }
    nTotalLength = process.checkRecordlistMaxLength(RecordList, 4096);
    lblRecords.setText(String.format("Records [%4d/%d] ", new Object[] { Integer.valueOf(nTotalLength), Integer.valueOf(4096) }));
    txtRecordTypeName.setText("");
    cmbRecordTypeName.select(0);
    txtRecordID.setText("");
    txtRecordPayload.setText("");
  }
  
  private void setRecordValue(NDEFRecord paramNDEFRecord)
  {
    paramNDEFRecord.setFormat(cmbRecordFormat.getSelectionIndex());
    if (cmbRecordFormat.getSelectionIndex() == 1) {
      paramNDEFRecord.setTypeName(TypeNameList[cmbRecordTypeName.getSelectionIndex()]);
    } else if (txtRecordTypeName.getText().isEmpty()) {
      paramNDEFRecord.setTypeName("Null");
    } else {
      paramNDEFRecord.setTypeName(txtRecordTypeName.getText());
    }
    if (txtRecordID.getText().isEmpty()) {
      paramNDEFRecord.setId("Null");
    } else {
      paramNDEFRecord.setId(txtRecordID.getText());
    }
    if (txtRecordPayload.getText().isEmpty()) {
      paramNDEFRecord.setPayload("Null");
    } else {
      paramNDEFRecord.setPayload(txtRecordPayload.getText());
    }
  }
  
  public IDevice getCurrentDevice()
  {
    return currentDevice;
  }
  
  public void setCurrentDevice(IDevice paramIDevice)
  {
    currentDevice = paramIDevice;
  }
  
  public ArrayList<NDEFRecord> getRecordList()
  {
    return RecordList;
  }
  
  public void setDisableState()
  {
    cmbRecordFormat.setEnabled(false);
    checkRecordFormat(0);
    cmbRecordList.setEnabled(false);
    butRecordAdd.setEnabled(false);
    butRecordEdit.setEnabled(false);
    butRecordRemove.setEnabled(false);
  }
  
  public void setEnableState()
  {
    cmbRecordFormat.setEnabled(true);
    checkRecordFormat(cmbRecordFormat.getSelectionIndex());
    txtRecordTypeName.setText("");
    cmbRecordTypeName.select(0);
    txtRecordID.setText("");
    txtRecordPayload.setText("");
    cmbRecordList.setEnabled(true);
    butRecordAdd.setEnabled(true);
    butRecordEdit.setEnabled(true);
    butRecordRemove.setEnabled(true);
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NDEFRecordPage
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

public class NfcCommand
{
  public static final Integer NFC_TAG_DISCOVERED = Integer.valueOf(100);
  public static final Integer NFC_TAG_DETACHED = Integer.valueOf(101);
  public static final Integer NFC_P2P_DISCOVERED = Integer.valueOf(102);
  public static final Integer NFC_P2P_DETACHED = Integer.valueOf(103);
  public static final Integer NFC_P2P_SEND = Integer.valueOf(104);
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NfcCommand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

class NfcDialog$1
  implements Runnable
{
  NfcDialog$1(Shell paramShell, String paramString1, String paramString2) {}
  
  public void run()
  {
    MessageBox localMessageBox = new MessageBox(val$s, 34);
    localMessageBox.setText(val$title);
    localMessageBox.setMessage(val$message);
    localMessageBox.open();
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NfcDialog.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

class NfcDialog$2
  implements Runnable
{
  NfcDialog$2(Shell paramShell, String paramString1, String paramString2) {}
  
  public void run()
  {
    MessageBox localMessageBox = new MessageBox(val$s, 33);
    localMessageBox.setText(val$title);
    localMessageBox.setMessage(val$message);
    localMessageBox.open();
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NfcDialog.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

public abstract class NfcDialog
{
  public static void openInfoDialog(String paramString)
  {
    openInfoDialog(new Shell(), paramString);
  }
  
  public static void openInfoDialog(Shell paramShell, String paramString)
  {
    Shell localShell;
    if (paramShell == null) {
      localShell = new Shell();
    } else {
      localShell = paramShell;
    }
    openInfoDialog(localShell, "Info", paramString);
  }
  
  public static void openInfoDialog(Shell paramShell, final String paramString1, final String paramString2)
  {
    Shell localShell;
    if (paramShell == null) {
      localShell = new Shell();
    } else {
      localShell = paramShell;
    }
    Display.getDefault().syncExec(new Runnable()
    {
      public void run()
      {
        MessageBox localMessageBox = new MessageBox(NfcDialog.this, 34);
        localMessageBox.setText(paramString1);
        localMessageBox.setMessage(paramString2);
        localMessageBox.open();
      }
    });
  }
  
  public static void openErrorDialog(String paramString)
  {
    openErrorDialog(new Shell(), paramString);
  }
  
  public static void openErrorDialog(Shell paramShell, String paramString)
  {
    Shell localShell;
    if (paramShell == null) {
      localShell = new Shell();
    } else {
      localShell = paramShell;
    }
    openErrorDialog(localShell, "Error", paramString);
  }
  
  public static void openErrorDialog(Shell paramShell, final String paramString1, final String paramString2)
  {
    Shell localShell;
    if (paramShell == null) {
      localShell = new Shell();
    } else {
      localShell = paramShell;
    }
    Display.getDefault().syncExec(new Runnable()
    {
      public void run()
      {
        MessageBox localMessageBox = new MessageBox(NfcDialog.this, 33);
        localMessageBox.setText(paramString1);
        localMessageBox.setMessage(paramString2);
        localMessageBox.open();
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NfcDialog
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

class NfcErrorString
{
  public static String RecordCountIsZero = "NDEF record list is empty\nAt least one or more records are required.";
  public static String RecordCountIsMax = "The number of NDEF records has reached the maximum limit of 5.\n";
  public static String MessageLenIsMax = "The length of the NDEF messag has reached the maximun limit of 4096 bytes.\n";
  public static String MediaFileException = "Throw exception while select media file.\n";
  public static String CheckVconfException = "Throw exception while check NFC state of emulator.\n";
  public static String SelecTagType = "Select Tag Type !!\n";
  public static String InvalidCharNewLine = "Can not enter a newline character.\n";
  public static String InvalidChar = "Can not enter ',' character.\nThis character is used separater character.\n";
  public static String InvalidCharAscii = "Invalid characters are entered.\nOnly ASCII characters can be entered.\n";
  public static String FailOpenDialog = "Can not open emulator's file dialog.\n";
  public static String EmptyFilePath = "Please choose media file.\n";
  public static String NotMimeType = "Type of selected file is not mime media type.\n";
  public static String BigSizeFile = "Size of selected file is too big.\nAvailable file size is under of 10KB.\n";
  public static String NFCIsDisable = "NFC state is 'Off' in the emulator.\nPlease change NFC state is 'On' on the setting menu.";
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NfcErrorString
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.tizen.common.connection.ui.TizenRemoteFileDialog;
import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.service.FileEntry;

class NfcHelpProcess$1
  implements Runnable
{
  NfcHelpProcess$1(NfcHelpProcess paramNfcHelpProcess, IDevice paramIDevice) {}
  
  public void run()
  {
    TizenRemoteFileDialog localTizenRemoteFileDialog = new TizenRemoteFileDialog(NfcHelpProcess.access$0(this$0), "Select a media file", val$currentDevice, false, "/opt/nfc");
    if (localTizenRemoteFileDialog.open() == TizenRemoteFileDialog.TizenRemoteFileDialogResult.OK)
    {
      NfcHelpProcess.access$1(this$0, localTizenRemoteFileDialog.getSelectedFileEntry());
      NfcHelpProcess.access$3(NfcHelpProcess.access$2(this$0).getFullPath());
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NfcHelpProcess.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import org.tizen.sdblib.receiver.MultiLineReceiver;

class NfcHelpProcess$2
  extends MultiLineReceiver
{
  NfcHelpProcess$2(NfcHelpProcess paramNfcHelpProcess) {}
  
  public void processNewLines(String[] paramArrayOfString)
  {
    NfcHelpProcess.access$4(this$0, paramArrayOfString[0]);
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.nfc.page.NfcHelpProcess.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.nfc.page;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.common.connection.ui.TizenRemoteFileDialog;
import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult;
import org.tizen.injector.socket.TelephonySocket;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.exception.SdbCommandRejectedException;
import org.tizen.sdblib.exception.ShellCommandUnresponsiveException;
import org.tizen.sdblib.exception.TimeoutException;
import org.tizen.sdblib.receiver.MultiLineReceiver;
import org.tizen.sdblib.service.FileEntry;

public class NfcHelpProcess
{
  private Shell shell = null;
  private static String MediaFilePath = null;
  private String shellCmd = null;
  private String shellResult = null;
  private FileEntry fileEntry = null;
  private TelephonySocket injectorSocket = TelephonySocket.getInstance();
  
  public NfcHelpProcess(Shell paramShell)
  {
    shell = paramShell;
  }
  
  public boolean checkInvalidCharaters(String paramString)
  {
    char[] arrayOfChar = new char['?'];
    paramString.getChars(0, paramString.length(), arrayOfChar, 0);
    for (int i = 0; i < paramString.length(); i++)
    {
      int j = arrayOfChar[i];
      if (j == 10)
      {
        NfcDialog.openInfoDialog(shell, NfcErrorString.InvalidCharNewLine);
        return false;
      }
      if (j == 44)
      {
        NfcDialog.openInfoDialog(shell, NfcErrorString.InvalidChar);
        return false;
      }
      if (j >= 128)
      {
        NfcDialog.openInfoDialog(shell, NfcErrorString.InvalidCharAscii);
        return false;
      }
    }
    return true;
  }
  
  public int checkRecordlistMaxLength(ArrayList<NDEFRecord> paramArrayList, int paramInt)
  {
    int i = 0;
    Iterator localIterator = paramArrayList.iterator();
    while (localIterator.hasNext())
    {
      NDEFRecord localNDEFRecord = (NDEFRecord)localIterator.next();
      i += 1 + localNDEFRecord.getTypeName().length() + localNDEFRecord.getId().length() + localNDEFRecord.getPayload().length() + 4;
    }
    if (i > paramInt)
    {
      NfcDialog.openInfoDialog(shell, "The length of the NDEF message has reached the maxium limit of " + paramInt + " bytes\n");
      return 0;
    }
    return i;
  }
  
  public String selectMediaFile(final IDevice paramIDevice)
  {
    MediaFilePath = null;
    if (shell != null) {
      shell.getDisplay().syncExec(new Runnable()
      {
        public void run()
        {
          TizenRemoteFileDialog localTizenRemoteFileDialog = new TizenRemoteFileDialog(shell, "Select a media file", paramIDevice, false, "/opt/nfc");
          if (localTizenRemoteFileDialog.open() == TizenRemoteFileDialog.TizenRemoteFileDialogResult.OK)
          {
            fileEntry = localTizenRemoteFileDialog.getSelectedFileEntry();
            NfcHelpProcess.MediaFilePath = fileEntry.getFullPath();
          }
        }
      });
    } else {
      NfcDialog.openErrorDialog(NfcErrorString.FailOpenDialog);
    }
    if (MediaFilePath == null)
    {
      NfcDialog.openErrorDialog(shell, NfcErrorString.EmptyFilePath);
    }
    else
    {
      String str = null;
      str = checkFileType(MediaFilePath);
      if (str == null)
      {
        NfcDialog.openErrorDialog(shell, NfcErrorString.NotMimeType);
        return null;
      }
      if (!checkFileSize(paramIDevice))
      {
        NfcDialog.openErrorDialog(shell, NfcErrorString.BigSizeFile);
        return null;
      }
    }
    return MediaFilePath;
  }
  
  public String checkFileType(String paramString)
  {
    int i = paramString.lastIndexOf('.');
    String str1 = null;
    if (i != -1)
    {
      String str2 = paramString.substring(i + 1);
      MimeTypeList localMimeTypeList = MimeTypeList.getInstance();
      str1 = localMimeTypeList.findMimeType(str2);
    }
    return str1;
  }
  
  private boolean checkFileSize(IDevice paramIDevice)
  {
    boolean bool = false;
    if (Integer.valueOf(fileEntry.getSize()).intValue() < 10000) {
      bool = true;
    }
    return bool;
  }
  
  private void errorCheckVconf(Exception paramException)
  {
    NfcDialog.openErrorDialog(shell, NfcErrorString.CheckVconfException + paramException.getMessage());
  }
  
  private boolean checkVconfValue()
  {
    boolean bool = false;
    IDevice localIDevice = ConnectionPlugin.getDefault().getCurrentDevice();
    shellCmd = "vconftool get db/nfc/enable";
    try
    {
      localIDevice.executeShellCommand(shellCmd, new MultiLineReceiver()
      {
        public void processNewLines(String[] paramAnonymousArrayOfString)
        {
          shellResult = paramAnonymousArrayOfString[0];
        }
      });
    }
    catch (TimeoutException localTimeoutException)
    {
      errorCheckVconf(localTimeoutException);
      return bool;
    }
    catch (SdbCommandRejectedException localSdbCommandRejectedException)
    {
      errorCheckVconf(localSdbCommandRejectedException);
      return bool;
    }
    catch (ShellCommandUnresponsiveException localShellCommandUnresponsiveException)
    {
      errorCheckVconf(localShellCommandUnresponsiveException);
      return bool;
    }
    catch (IOException localIOException)
    {
      errorCheckVconf(localIOException);
      return bool;
    }
    if (shellResult != null) {
      if (shellResult.indexOf('1') != -1) {
        bool = true;
      } else {
        NfcDialog.openInfoDialog(shell, NfcErrorString.NFCIsDisable);
      }
    }
    return bool;
  }
  
  public boolean sendMessage(Integer paramInteger, int paramInt, ArrayList<NDEFRecord> paramArrayList)
  {
    if (!checkVconfValue()) {
      return (paramInteger != NfcCommand.NFC_TAG_DISCOVERED) && (paramInteger != NfcCommand.NFC_P2P_DISCOVERED) && (paramInteger != NfcCommand.NFC_P2P_SEND);
    }
    String str1 = null;
    Object localObject2;
    Object localObject1;
    switch (paramInteger.intValue())
    {
    case 100: 
      if ((paramInt != -1) && (paramInt != 0))
      {
        String str2 = new String();
        str2 = str2 + "," + paramArrayList.size();
        localObject2 = paramArrayList.iterator();
        while (((Iterator)localObject2).hasNext())
        {
          localObject1 = (NDEFRecord)((Iterator)localObject2).next();
          str2 = str2 + "," + ((NDEFRecord)localObject1).getFormat() + "," + ((NDEFRecord)localObject1).getTypeName() + "," + ((NDEFRecord)localObject1).getId() + "," + ((NDEFRecord)localObject1).getPayload();
        }
        str1 = NfcCommand.NFC_TAG_DISCOVERED.toString() + ":" + String.valueOf(paramInt) + str2 + "\n";
      }
      else
      {
        NfcDialog.openErrorDialog(shell, NfcErrorString.SelecTagType);
        return false;
      }
      break;
    case 101: 
      str1 = NfcCommand.NFC_TAG_DETACHED.toString() + ":" + "\n";
      break;
    case 102: 
      str1 = NfcCommand.NFC_P2P_DISCOVERED.toString() + ":\n";
      break;
    case 103: 
      str1 = NfcCommand.NFC_P2P_DETACHED.toString() + ":\n";
      break;
    case 104: 
      int i = 5;
      localObject1 = new String();
      localObject1 = localObject1 + "," + paramArrayList.size();
      Iterator localIterator = paramArrayList.iterator();
      while (localIterator.hasNext())
      {
        localObject2 = (NDEFRecord)localIterator.next();
        localObject1 = localObject1 + "," + ((NDEFRecord)localObject2).getFormat() + "," + ((NDEFRecord)localObject2).getTypeName() + "," + ((NDEFRecord)localObject2).getId() + "," + ((NDEFRecord)localObject2).getPayload();
      }
      str1 = NfcCommand.NFC
1 2

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd