public class TransferUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static int |
answer(TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Answers the phone (begins an incoming call).
|
static int |
deleteAlarm(int alarmNo,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Delete the given alarm from the phone.
|
static int |
deleteFile(PhoneElement element,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Delete the given element from the phone.
|
static int |
deleteMessage(PhoneMessage element,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Delete the given message from the phone.
|
static int |
dialNumber(java.lang.String number,
boolean isVoice,
DataTransporter.DIAL_MODE dialMode,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Dials the given number through the phone.
|
static int |
downloadAlarmList(TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor,
javax.swing.JTable alarms,
java.util.Vector<PhoneAlarm> placeForData)
Downloads the list of alarms from the phone.
|
static int |
downloadFile(java.io.File f,
PhoneElement element,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Downloads the given file from the phone.
|
static int |
downloadFiles(java.lang.String type,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor,
java.lang.String destDir,
boolean deleteAfterDownload)
Downloads files of the given type from the phone.
|
static int |
downloadList(java.lang.String ofWhat,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor,
javax.swing.table.DefaultTableModel dtm,
java.util.Vector<PhoneElement> placeForData)
Downloads the list of files of the given type from the phone.
|
static int |
downloadMessageList(TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor,
javax.swing.JTable messages,
java.util.Vector<PhoneMessage> placeForData)
Downloads the list of messages from the phone.
|
static gnu.io.CommPortIdentifier |
getIdentifierForPort(java.lang.String port)
Returns the CommPortIdentifier for the given port or the first
serial port's identifier.
|
static java.util.Vector<java.lang.String> |
getSerialPortNames()
Gets all the serial ports' names.
|
static int |
hangup(TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Hangs the phone up (stops the current call).
|
static int |
scanPorts(boolean quiet,
TransferParameters tp,
java.util.Map<java.lang.String,java.lang.String> firmwares,
java.util.Map<java.lang.String,java.lang.String> phoneTypes,
java.util.Map<java.lang.String,java.lang.String> phoneIMEIs,
java.util.Map<java.lang.String,java.lang.String> phoneSubsNums,
java.util.Vector<java.lang.String> replied,
java.lang.Runnable afterPort)
Scans all the serial ports with "AT", looking for "OK" responses.
|
static int |
sendFileAsCommands(java.io.File f,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Sends the given file (which should contain raw commands, rather
then be a supported media file).
|
static int |
sendMessage(PhoneMessage element,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Send the given message through the phone.
|
static int |
uploadAlarm(PhoneAlarm alarm,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Uploads the given alarm to the phone.
|
static int |
uploadFile(java.io.File f,
TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Uploads the given file to the phone.
|
static int |
volumeDown(TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Decreases the volume level.
|
static int |
volumeUp(TransferParameters tp,
java.lang.Runnable onDone,
java.awt.Component parent,
boolean quiet,
boolean quietGUI,
boolean waitFor)
Increases the volume level.
|
public static int uploadFile(java.io.File f, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
f
- The file to upload. Can't be null.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int downloadFile(java.io.File f, PhoneElement element, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
f
- The file to save the data to. Can't be null.element
- The element to download.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int deleteFile(PhoneElement element, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
element
- The element to delete.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int uploadAlarm(PhoneAlarm alarm, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
alarm
- The alarm to upload. Can't be null.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int deleteAlarm(int alarmNo, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
alarmNo
- The alarm number to delete.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int downloadFiles(java.lang.String type, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor, java.lang.String destDir, boolean deleteAfterDownload)
type
- The type of the files to download. One of
PICTURES, RINGTONES, VTODO, VEVENT, VCARDS, ANIMATIONS. Can't be null.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.destDir
- The destination directory to put the downloaded files in.deleteAfterDownload
- If TRUE, the elements will be deleted from the phone
after they're successfully downloaded.public static int downloadList(java.lang.String ofWhat, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor, javax.swing.table.DefaultTableModel dtm, java.util.Vector<PhoneElement> placeForData)
ofWhat
- The type of the files to download. One of
PICTURES, RINGTONES, VTODO, VEVENT, VCARDS, ANIMATIONS. Can't be null.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.dtm
- The table to put the data in or null.placeForData
- The place for the found elements or null.public static int downloadAlarmList(TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor, javax.swing.JTable alarms, java.util.Vector<PhoneAlarm> placeForData)
tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.alarms
- The table to put the data in or null.placeForData
- The place for the found elements or null.public static int downloadMessageList(TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor, javax.swing.JTable messages, java.util.Vector<PhoneMessage> placeForData)
tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.messages
- The table to put the data in or null.placeForData
- The place for the found elements or null.public static int deleteMessage(PhoneMessage element, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
element
- The message to delete.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int sendMessage(PhoneMessage element, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
element
- The message to send.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int dialNumber(java.lang.String number, boolean isVoice, DataTransporter.DIAL_MODE dialMode, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
number
- the number to dial. Must be non-null.isVoice
- whether the connection is for voice or data. Voice connections
will be initiated by adding a semicolon to the end of the number.dialMode
- The dial mode (tone, pulse, auto). Defaults to "auto" if null.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int hangup(TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int answer(TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int volumeUp(TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int volumeDown(TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static int sendFileAsCommands(java.io.File f, TransferParameters tp, java.lang.Runnable onDone, java.awt.Component parent, boolean quiet, boolean quietGUI, boolean waitFor)
f
- The file to send.tp
- The port parameters to use.onDone
- The code to run at transfer end.parent
- The parent frame for displaying messages.quiet
- If TRUE, no messages will be displayed.quietGUI
- If TRUE, no messageboxes will be displayed.waitFor
- If TRUE, the background thread will be waited for.public static gnu.io.CommPortIdentifier getIdentifierForPort(java.lang.String port)
port
- The port to get the identifier for or null
to
get the identifier of the first serial port.public static int scanPorts(boolean quiet, TransferParameters tp, java.util.Map<java.lang.String,java.lang.String> firmwares, java.util.Map<java.lang.String,java.lang.String> phoneTypes, java.util.Map<java.lang.String,java.lang.String> phoneIMEIs, java.util.Map<java.lang.String,java.lang.String> phoneSubsNums, java.util.Vector<java.lang.String> replied, java.lang.Runnable afterPort)
quiet
- If TRUE, no messages will be printed.tp
- The port parameters to use.firmwares
- If not null, will get the detected firmware versions for the scanned ports.phoneTypes
- If not null, will get the detected phone types for the scanned ports.phoneIMEIs
- If not null, will get the detected phone IMEI numbers for the scanned ports.phoneSubsNums
- If not null, will get the detected phone subscriber numbers for the scanned ports.replied
- If not null, will be filled with the names of the ports that have replied.afterPort
- If not null, will be called after each port is scanned (whether
successful or not).public static java.util.Vector<java.lang.String> getSerialPortNames()