protocol.h

Go to the documentation of this file.
00001 ///
00002 /// \file       protocol.h
00003 ///             USB Blackberry bulk protocol API constants
00004 ///
00005 
00006 /*
00007     Copyright (C) 2005-2012, Net Direct Inc. (http://www.netdirect.ca/)
00008 
00009     This program is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     This program is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00017 
00018     See the GNU General Public License in the COPYING file at the
00019     root directory of this project for more details.
00020 */
00021 
00022 #ifndef __BARRY_PROTOCOL_H__
00023 #define __BARRY_PROTOCOL_H__
00024 
00025 // packet commands (Packet.command: has response codes too)
00026 #define SB_COMMAND_ECHO                 0x01
00027 #define SB_COMMAND_ECHO_REPLY           0x02
00028 #define SB_COMMAND_RESET                0x03
00029 #define SB_COMMAND_RESET_REPLY          0x04
00030 #define SB_COMMAND_FETCH_ATTRIBUTE      0x05
00031 #define SB_COMMAND_FETCHED_ATTRIBUTE    0x06
00032 #define SB_COMMAND_SELECT_MODE          0x07
00033 #define SB_COMMAND_MODE_SELECTED        0x08
00034 #define SB_COMMAND_MODE_NOT_SELECTED    0x09
00035 #define SB_COMMAND_OPEN_SOCKET          0x0a
00036 #define SB_COMMAND_CLOSE_SOCKET         0x0b
00037 #define SB_COMMAND_CLOSED_SOCKET        0x0c
00038 #define SB_COMMAND_REMOTE_CLOSE_SOCKET  0x0d
00039 #define SB_COMMAND_PASSWORD_CHALLENGE   0x0e
00040 #define SB_COMMAND_PASSWORD             0x0f
00041 #define SB_COMMAND_OPENED_SOCKET        0x10
00042 #define SB_COMMAND_PASSWORD_FAILED      0x11
00043 #define SB_COMMAND_SEQUENCE_HANDSHAKE   0x13
00044 #define SB_COMMAND_DB_DATA              0x40
00045 #define SB_COMMAND_DB_FRAGMENTED        0x60
00046 #define SB_COMMAND_DB_DONE              0x41
00047 
00048 // JavaLoader commands
00049 #define SB_COMMAND_JL_HELLO             0x64    // This could be a general ACK in both directions
00050 #define SB_COMMAND_JL_HELLO_ACK         0x65    // From device after host HELLO
00051 #define SB_COMMAND_JL_GOODBYE           0x8d
00052 #define SB_COMMAND_JL_SET_UNKNOWN1      0x70    // Initial sequence, 0
00053 #define SB_COMMAND_JL_SET_COD_FILENAME  0x80
00054 #define SB_COMMAND_JL_SET_COD_SIZE      0x67    // Always big endian
00055 #define SB_COMMAND_JL_SEND_DATA         0x68
00056 #define SB_COMMAND_JL_SET_TIME          0x7c
00057 #define SB_COMMAND_JL_GET_SCREENSHOT    0x87
00058 #define SB_COMMAND_JL_DEVICE_INFO       0x71
00059 #define SB_COMMAND_JL_OS_METRICS        0x78
00060 #define SB_COMMAND_JL_BOOTROM_METRICS   0x79
00061 #define SB_COMMAND_JL_GET_DIRECTORY     0x6d
00062 #define SB_COMMAND_JL_GET_DATA_ENTRY    0x6e    // Used for both DIR and SCREENSHOT
00063 #define SB_COMMAND_JL_GET_SUBDIR        0x7f
00064 #define SB_COMMAND_JL_GET_SUBDIR_ENTRY  0x7d
00065 #define SB_COMMAND_JL_ERASE             0x69
00066 #define SB_COMMAND_JL_FORCE_ERASE       0x7b
00067 #define SB_COMMAND_JL_UNKNOWN3          0x63
00068 #define SB_COMMAND_JL_GET_LOG           0x73
00069 #define SB_COMMAND_JL_GET_LOG_ENTRY     0x74
00070 #define SB_COMMAND_JL_CLEAR_LOG         0x88
00071 #define SB_COMMAND_JL_SAVE_MODULE       0x7e
00072 #define SB_COMMAND_JL_WIPE_APPS         0x6a
00073 #define SB_COMMAND_JL_WIPE_FS           0x6b
00074 #define SB_COMMAND_JL_LOG_STRACES       0x8e
00075 #define SB_COMMAND_JL_RESET_FACTORY     0x91
00076 
00077 // JavaLoader response
00078 #define SB_COMMAND_JL_ACK               0x64
00079 #define SB_COMMAND_JL_READY             0x01
00080 #define SB_COMMAND_JL_RESET_REQUIRED    0x78    // Occurs after GOODBYE when handheld reset is required
00081 #define SB_COMMAND_JL_COD_IN_USE        0x6c    // Perhaps "BUSY" is also a good name?
00082 #define SB_COMMAND_JL_COD_NOT_FOUND     0x69
00083 #define SB_COMMAND_JL_NOT_ENOUGH_MEMORY 0x6a    // Occurs when the internal memory isn't enough to install the new COD file
00084 #define SB_COMMAND_JL_NOT_SUPPORTED     0x71    // Occurs when device does not support a command
00085 
00086 // JavaLoader data
00087 #define SB_DATA_JL_SUCCESS              0x64    // Device has accepted the data packet
00088 #define SB_DATA_JL_INVALID              0x68    // Device returns this code if the application isn't valid.
00089 
00090 
00091 // JDWP Command set list
00092 #define JDWP_CMDSET_VIRTUALMACHINE              1
00093 #define JDWP_CMDSET_REFERECENTYPE               2
00094 #define JDWP_CMDSET_CLASSTYPE                   3
00095 #define JDWP_CMDSET_ARRAYTYPE                   4
00096 #define JDWP_CMDSET_INTERFACETYPE               5
00097 #define JDWP_CMDSET_METHOD                      6
00098 #define JDWP_CMDSET_FIELD                       8
00099 #define JDWP_CMDSET_OBJECTREFERENCE             9
00100 #define JDWP_CMDSET_STRINGREFERENCE             10
00101 #define JDWP_CMDSET_THREADREFERENCE             11
00102 #define JDWP_CMDSET_THREADGROUPREFERENCE        12
00103 #define JDWP_CMDSET_ARRAYREFERENCE              13
00104 #define JDWP_CMDSET_CLASSLOADERREFERENCE        14
00105 #define JDWP_CMDSET_EVENTREQUEST                15
00106 #define JDWP_CMDSET_STACKFRAME                  16
00107 #define JDWP_CMDSET_CLASSOBJECTREFERENCE        17
00108 #define JDWP_CMDSET_EVENT                       64
00109 
00110 // JDWP Command list - VirtualMachine
00111 #define JDWP_CMD_VERSION                        1
00112 #define JDWP_CMD_ALLCLASSES                     3
00113 #define JDWP_CMD_ALLTHREADS                     4
00114 #define JDWP_CMD_DISPOSE                        6
00115 #define JDWP_CMD_IDSIZES                        7
00116 #define JDWP_CMD_SUSPEND                        8
00117 #define JDWP_CMD_RESUME                         9
00118 #define JDWP_CMD_CLASSPATHS                     13
00119 
00120 // JDWP Command list - EventRequest
00121 #define JDWP_CMD_SET                            1
00122 
00123 // JVMDebug commands
00124 #define SB_COMMAND_JVM_UNKNOWN01        0x53
00125 #define SB_COMMAND_JVM_UNKNOWN02        0x01
00126 #define SB_COMMAND_JVM_UNKNOWN03        0x6f
00127 #define SB_COMMAND_JVM_UNKNOWN04        0x8a
00128 #define SB_COMMAND_JVM_UNKNOWN05        0x90
00129 #define SB_COMMAND_JVM_UNKNOWN06        0x44
00130 #define SB_COMMAND_JVM_UNKNOWN07        0x45
00131 #define SB_COMMAND_JVM_UNKNOWN08        0x54
00132 #define SB_COMMAND_JVM_UNKNOWN09        0x33
00133 #define SB_COMMAND_JVM_UNKNOWN10        0x46
00134 
00135 #define SB_COMMAND_JVM_UNKNOWN11        0x0e
00136 #define SB_COMMAND_JVM_UNKNOWN12        0x50
00137 #define SB_COMMAND_JVM_UNKNOWN13        0x0d
00138 #define SB_COMMAND_JVM_UNKNOWN14        0x85
00139 #define SB_COMMAND_JVM_UNKNOWN15        0x84
00140 
00141 #define SB_COMMAND_JVM_GET_MODULES_LIST 0x8d    // Get all Java modules list with their address and ID
00142 #define SB_COMMAND_JVM_GET_THREADS_LIST 0x08    // Get all threads currently running in the virtual machine
00143 #define SB_COMMAND_JVM_GET_CONSOLE_MSG  0x40    // Get console message
00144 #define SB_COMMAND_JVM_GO               0x02    // Go
00145 #define SB_COMMAND_JVM_GET_STATUS       0x06    // Get status
00146 #define SB_COMMAND_JVM_SET_BREAKPOINT   0x21    // Set breakpoint
00147 #define SB_COMMAND_JVM_RM_BREAKPOINT    0x22    // Remove breakpoint
00148 
00149 #define SB_COMMAND_JVM_STOP             0xa502
00150 
00151 // JavaDebug response
00152 #define SB_COMMAND_JVM_GET_DATA_ENTRY   0x06
00153 
00154 
00155 // mode constants
00156 #define SB_MODE_REQUEST_SOCKET          0x00ff
00157 
00158 
00159 // object and attribute ID codes (for ZeroPacket::GetAttribute())
00160 // meanings for most of these are unknown
00161 #define SB_OBJECT_INITIAL_UNKNOWN               0x14
00162 #define         SB_ATTR_INITIAL_UNKNOWN         0x01
00163 #define SB_OBJECT_PROFILE                       0x08
00164 #define         SB_ATTR_PROFILE_DESC            0x02
00165 #define         SB_ATTR_PROFILE_PIN             0x04
00166 #define SB_OBJECT_SOCKET_UNKNOWN                0x04
00167 
00168 
00169 // param command parameters
00170 //#define SB_PARAM_DEFAULT              0xff
00171 
00172 
00173 // DB Operation Command
00174 #define SB_DBOP_ADD_RECORD              0x41
00175 #define SB_DBOP_CLEAR_DATABASE          0x43
00176 #define SB_DBOP_GET_DBDB                0x4a
00177 #define SB_DBOP_OLD_GET_DBDB            0x4c
00178 #define SB_DBOP_GET_COUNT               0x4e
00179 #define SB_DBOP_GET_RECORDS             0x4f
00180 #define SB_DBOP_OLD_GET_RECORDS         0x42
00181 #define SB_DBOP_OLD_GET_RECORDS_REPLY   0x44
00182 
00183 #define SB_DBOP_GET_RECORD_STATE_TABLE  0x53    // replies with 0x60, 0x41
00184 #define SB_DBOP_SET_RECORD_FLAGS        0x54    // replies with 0x41
00185                                                 // used to clear dirty flag
00186 #define SB_DBOP_GET_RECORD_BY_INDEX     0x46    // replies with 0x44
00187         // John's device uses 0x50, with a reply of 0x4f (!)
00188         // Then uses 0x55 as usual
00189         // Delete uses 0x50/0x4f to check as well, then uses 0x52 as
00190         // usual to do the actual delete.
00191 #define SB_DBOP_SET_RECORD_BY_INDEX     0x55    // replies with 0x41
00192 #define SB_DBOP_DELETE_RECORD_BY_INDEX  0x52    // intellisync does a GET(0x46)
00193                                                 // first, probably to make sure
00194                                                 // it has the right data and
00195                                                 // record
00196 
00197 #endif
00198