Reference of IPTTPlugin4

Description of IPTTPlugin4. Server 6.x and above is required.

IVideoPlugin of V3

ICallback4

In plug-in4, developers can use internal API of PTT server.

getDBConnection

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

sendToChannel

void sendToChannel(int channelId, String message)
channelIdchannel Id
messagemessage
DescriptionSend a message to a channel
Common library version4.0.x

sendToUser

void sendToUser(String userStrId, String message)
userStrIduser's Id
messagelog message
DescriptionSend a message to a user
Common library version4.0.x

sendToCompanyUsers

void sendToCompanyUsers(int companyId, String message)
companyIdcompanyId's Id
messagelog message
DescriptionSend a message to all user
Common library version4.0.x

writeLog

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

writeErrorLog

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

OnInitialized

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

IPTTPlugin4

getInterfaceVersion

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

getType

int getType()
Returnmost be retured TYPE_GENERAL_PLUGIN
DescriptionNotify plug-in's type
Common library version3.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 version3.0.x

OnConnected

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

OnJoined

void OnJoined(String userId, int channelId)
userIdjoined user's id
channelIdjoined channel id
DescriptionChannel joined event
Common library version3.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 version3.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 version3.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 version3.0.x

OnVideoShare

void OnVideoShare(String userId, int channelId, int videoChannelId, String jsonParams)
userIdshared user's id
channelIdshared channel id
videoChannelIdshared video channel id
jsonParamsextended parameters
DescriptionIn channel, video share event from sharer.
Common library version3.0.x

OnVideoShared

void OnVideoShared(String userId, int channelId, int videoChannelId)
userIdshared user's id
channelIdshared channel id
videoChannelIdshared video channel id
DescriptionIn channel, video shared event from system.
Common library version3.0.x

OnVideoUnshare

void OnVideoUnshared(String userId, int channelId, int videoChannelId, String jsonParams)
userIdunshared user's id
channelIdunshared channel id
videoChannelIdunshared video channel id
jsonParamsextended parameters
DescriptionIn channel, video unshare event from sharer.
Common library version3.0.x

OnVideoUnshared

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

OnFileShare

void OnFileShare(String userId, int channelId, int fileChannelId, String jsonParams)
userIdshared user's id
channelIdshared channel id
videoChannelIdshared file channel id
jsonParamsextended parameters
DescriptionIn channel, file share event from sharer.
Not supported yet
Common library version3.0.x

OnFileShared

void OnFileShared(String userId, int channelId, int fileChannelId)
userIdshared user's id
channelIdshared channel id
videoChannelIdshared file channel id
DescriptionIn channel, file shared event from system.
Not supported yet
Common library version3.0.x

OnFileUnshare

void OnFileUnshared(String userId, int channelId, int fileChannelId, String jsonParams)
userIdunshared user's id
channelIdunshared channel id
videoChannelIdunshared video channel id
jsonParamsextended parameters
DescriptionIn channel, file unshare event from sharer.
Not supported yet
Common library version3.0.x

OnFileUnshared

void OnFileUnshared(String userId, int channelId, int fileChannelId)
userIdunshared user's id
channelIdunshared channel id
videoChannelIdunshared file channel id
DescriptionIn channel, file unshared event from system.
Not supported yet
Common library version3.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 version3.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 version3.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 version3.0.x

OnLocation

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

OnLeaved

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

OnDisconnected

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

OnClientDirectMessage

void OnClientDirectMessage(String userId, String message)
userIdsender's id
messagemessage from SDK4(sendMessageToServerPlugin)
DescriptionReceived a message from SDK
Common library version4.0.x

OnError

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

OnExtenedEvent

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