Reference of IPTTPlugin2

Description of IPTTPlugin2

Depreciated

IVideoPlugin of V2

ICallback2

In plug-in2, developer can use internal API of PTT server.

getDBConnection

Connection getDBConnection()
Returnjava.sql.Connection
DescriptionGet DB connection from DB connection pool in server.
Common library version2.0.x

writeLog

void writeLog(String message)
messagelog message
DescriptionWrite log in {ProPTT server dir}/logs/service/PTT.service.log
Common library version2.0.x

writeErrorLog

void writeErrorLog(String message)
messagelog message
DescriptionWrite error log in {ProPTT server dir}/logs/service/PTT.service.log
Common library version2.0.x

OnInitialized

void OnInitialized()
DescriptionNotify initialized to PTT server.
Common library version2.0.x

IPTTPlugin2

getInterfaceVersion

int getInterfaceVersion()
Returnmost be retured INTERFACE_VERSION
DescriptionNotify plug-in's INTERFACE version
Common library version2.0.x

getType

int getType()
Returnmost be retured TYPE_GENERAL_PLUGIN
DescriptionNotify plug-in's type
Common library version2.0.x

initialize

boolean initialize(String arg)
argargument for initialization. It is on arg tag in system.xml.
Returnresult of initialize
Descriptioninitialize plug-in
Common library version2.0.x

OnConnected

void OnConnected(String userId, String jsonParams)
userIdconnected user's id
jsonParamsextended parameters
DescriptionUser connected event
Common library version2.0.x

OnJoined

void OnJoined(String userId, int channelId)
userIdjoined user's id
channelIdjoined channel id
DescriptionChannel joined event
Common library version2.0.x

OnLocked

void OnLocked(String userId, int channelId, int lockIndex, int mediaProfileId, String userLocation, String audioCodec, String videoCodec, String encKey, String jsonParams)
userIdjoined user's id
channelIdjoined channel id
lockIndexlock index, 0:mormal,1:master's lock
mediaProfileIdaudio ptt or video ptt
userLocationlocked location
audioCodecaudio codec config
videoCodecvideo codec condig
encKeyif an encrypted channel, encKey is required to decrypt
jsonParamsextended parameters
DescriptionChannel locked event
Common library version2.0.x

OnPTT

OnPTT(int channelId, int lockIndex, byte[] frames)
channelIdjoined channel id
lockIndexlock index, 0:mormal,1:master's lock
framesmedia frame
Descriptioneach ptt packet event
Common library version2.0.x
< frames format >
fieldtypebytesDescription
MediaTrackIDunsigned short2Media Track
FarmIDshort2Farm’s ID
ChannelIDint4Channel’s ID
Timestampunsigned int4Timestamp
FrameTypebyte10: Media, 1: CodecInfo
FrameInfobyte1Audio(Frame Count)
Video(0x1X:R-0, 0x2X:R-90, 0x3X: R-180, 0x4X:R-270 | 0xX0: Mid, 0xX1:End)
PadCountbyte1Padding size
Reservedbyte1Reserved
FrameDatabyte[]Frame's data

OnUnLocked

void OnUnLocked(String userId, int channelId, int lockIndex)
userIdunlocked user's id
channelIdunlocked channel id
lockIndexlock index, 0:mormal,1:master's lock
DescriptionChannel unlocked event
Common library version2.0.x

OnVideoShared

void OnVideoShared(String userId, int channelId, int videoChannelId, String jsonParams)
userIdshared user's id
channelIdshared channel id
videoChannelIdshared video channel id
jsonParamsextended parameters
DescriptionIn channel, video shared event
Common library version2.0.x

OnUnVideoShared

void OnUnVideoShared(String userId, int channelId, int videoChannelId)
userIdunshared user's id
channelIdunshared channel id
videoChannelIdunshared video channel id
DescriptionIn channel, video unshared event
Common library version2.0.x

OnText

void OnText(String userId, int channelId, int messageId, String base64Message)
userIduser's id
channelIdchannel id
messageIdmessage's id. it is not unique
base64Messagebase64(message)
DescriptionIn channel, sent text message
Common library version2.0.x

OnCustomMessage

void OnCustomMessage(String userId, int channelId, int messageId, String base64Message)
userIduser's id
channelIdchannel id
messageIdmessage's id. it is not unique
base64Messagebase64(message)
DescriptionIn channel, sent custom message
Common library version2.0.x

OnFunction

OnFunction(String userId, int channelId, String latitude, String longitude, String functionName, String jsonParams)
userIduser's id
channelIdchannel id
messageIdmessage's id. it is not unique
latitudelatitude
longitudelongitude
functionNamefunction's name. "sos"|"message:base64(message)"|"call-event"|and so on
jsonParamsextended parameters
DescriptionIn channel, sent function call
Common library version2.0.x

OnLocation

void OnLocation(String userId, String latitude, String longitude)
userIduser's id
latitudelatitude
longitudelongitude
DescriptionUser location is updated.
Common library version2.0.x

OnLeaved

void OnLeaved(String userId, int channelId)
userIduser's id
channelIdchannel id
DescriptionUser leaved channel
Common library version2.0.x

OnDisconnected

void OnDisconnected(String userId)
userIduser's id
DescriptionUser disconnected
Common library version2.0.x

OnError

void OnError(int errCode, String jsonParams)
errCodeerror code. not defined
jsonParamsextended parameters
Descriptionfired error
Common library version2.0.x

OnExtenedEvent

void OnExtenedEvent(String cmdName, String jsonParams)
cmdNamecommend name. not defined
jsonParamsextended parameters
DescriptionFired an extended event
Common library version2.0.x