Carrier¶
-
public class
Carrier¶ The class representing Carrier node instance.
Fields¶
Methods¶
acceptFriend¶
-
public void
acceptFriend(String userId)¶ Accept the friend request. This function is used to add a friend in response to a friend request.
- Parameters
userId – The user id who want be friend with us.
- Throws
IllegalArgumentException – IOEXException
acceptFriendFile¶
-
public void
acceptFriendFile(String fileid, String filename, String filepath)¶ Accept a file from a friend.
- Parameters
fileid – The accepted file id
filename – New file name
filepath – The saved path for the accepted file
- Throws
IllegalArgumentException – IOEXException
acceptFriendTunnel¶
-
public void
acceptFriendTunnel(int tunnel_id)¶ Accept a tunnel request from a friend.
- Parameters
tunnel_id – The id of the tunnel
- Throws
IllegalArgumentException – IOEXException
addFriend¶
-
public void
addFriend(String address, String hello)¶ Add friend by sending a new friend request. This function will add a new friend with specific address, and then send a friend request to the target node.
- Parameters
address – the target user address of remote carrier node.
hello – PIN for target user, or any application defined content
- Throws
IllegalArgumentException – IOEXException
answerFriendCall¶
-
public void
answerFriendCall(String friendId)¶ Accept an AV call request from a friend and use default audio and video bitrate settings, which are 96 kbps and 1000 kbps, respectively.
- Parameters
friendId – Id of the friend.
- Throws
IllegalArgumentException – IOEXException
answerFriendCall¶
-
public void
answerFriendCall(String friendId, int audioBitrate, int videoBitrate)¶ Accept an AV call request from a friend.
- Parameters
friendId – Id of the friend.
audioBitrate – Desire bitrate in kbps to transmit audio data. Common values are 64, 96, 128 and 196. Pass 0 to disable audio transmitting.
videoBitrate – Desire bitrate in kbps to transmit video data. Usually range between 400 to 14000. Pass 0 to disable video transmitting.
- Throws
IllegalArgumentException – IOEXException
callFriend¶
-
public void
callFriend(String friendId)¶ Send AV call request to a friend and use default audio and video bitrate settings, which are 96 kbps and 1000 kbps, respectively.
- Parameters
friendId – Id of the friend.
- Throws
IllegalArgumentException – IOEXException
callFriend¶
-
public void
callFriend(String friendId, int audioBitrate, int videoBitrate)¶ Send AV call request to a friend.
- Parameters
friendId – Id of the friend.
audioBitrate – Desire bitrate in kbps to transmit audio data. Common values are 64, 96, 128 and 196. Pass 0 to disable audio transmitting.
videoBitrate – Desire bitrate in kbps to transmit video data. Usually range between 400 to 14000. Pass 0 to disable video transmitting.
- Throws
IllegalArgumentException – IOEXException
cancelFriendFile¶
-
public boolean
cancelFriendFile(String fileid)¶ Cancel the process of sending/receiving a file to/from a friend.
- Parameters
fileid – The id of the canceling file
- Throws
IllegalArgumentException – IOEXException
cancelFriendTunnel¶
-
public void
cancelFriendTunnel(int tunnel_id)¶ Cancel a tunnel with a friend.
- Parameters
tunnel_id – The id of the tunnel
- Throws
IllegalArgumentException – IOEXException
getAddress¶
getCallInfo¶
-
public AvCallInfo
getCallInfo()¶ Get current AV call information.
- Throws
IllegalArgumentException – IOEXException
- Returns
An AvCallInfo object which contains call status.
getFileInfo¶
-
public FileInfo
getFileInfo(String fileid)¶ Get the information of the file transferring.
- Parameters
fileid – The file id
- Throws
IllegalArgumentException – IOEXException
getFriend¶
-
public FriendInfo
getFriend(String userId)¶ Get specified friend information.
- Parameters
userId – The user identifier of friend
- Throws
IllegalArgumentException – IOEXException
- Returns
The friend information.
getFriends¶
-
public List<FriendInfo>
getFriends()¶ Get friends list.
- Throws
- Returns
The list of friend information to current user
getIdFromAddress¶
getInstance¶
getNodeId¶
getNospam¶
-
public int
getNospam()¶ ~Egnlish Get the nospam for Carrier address. Get the 4-byte nospam part of the Carrier address with host byte order expected. Nospam for Carrier address is used to eliminate spam friend request.
- Throws
getPresence¶
-
public PresenceStatus
getPresence()¶ Get self presence status.
- Throws
getSelfInfo¶
getUserId¶
getVersion¶
hangupFriendCall¶
-
public void
hangupFriendCall(String friendId)¶ Hangup an existing call, or reject a friend’s call request.
- Parameters
friendId – Id of the friend.
- Throws
IllegalArgumentException – IOEXException
initializeInstance¶
-
public static void
initializeInstance(Options options, CarrierHandler handler)¶ Initialize node singleton instance. After initializing the instance, it’s ready to start and therefore connect to carrier network.
- Parameters
options – The options to set for creating carrier node.
handler – The interface handler for carrier node.
- Throws
inviteFriend¶
-
public void
inviteFriend(String to, String data, FriendInviteResponseHandler handler)¶ Send invite request to a friend. Application can attach the application defined data with in the invite request, and the data will send to target friend.
- Parameters
to – The target id
data – The application defined data send to target user
handler – The handler to receive invite reponse
- Throws
IllegalArgumentException – IOEXException
isFriend¶
-
public boolean
isFriend(String userId)¶ Check if the user ID is friend.
- Parameters
userId – The userId to check
- Throws
IllegalArgumentException – IOEXException
- Returns
True if the user is a friend, or false if not
isReady¶
-
public boolean
isReady()¶ ~English Check if carrier node instance is being ready. All carrier interactive APIs should be called only if carrier node instance is being ready.
- Returns
true if the carrier node instance is ready, or false if not.
isValidAddress¶
isValidId¶
kill¶
-
public synchronized void
kill()¶ Disconnect carrier node from carrier network, and destroy all associated resources to carreier node instance. After calling the method, the carrier node instance becomes invalid.
labelFriend¶
-
public void
labelFriend(String userId, String label)¶ Set the label of the specified friend. The label of a friend is a private alias name for current user. It can be seen by current user only, and has no impact to the target friend itself.
- Parameters
userId – The friend’s user identifier
label – The new label of specified friend
- Throws
IllegalArgumentException – IOEXException
pauseFriendCall¶
-
public void
pauseFriendCall(String friendId)¶ Pause an existing call with a friend.
- Parameters
friendId – Id of the friend.
- Throws
IllegalArgumentException – IOEXException
pauseFriendFile¶
-
public boolean
pauseFriendFile(String fileid)¶ Pause the process of sending/receiving a file to/from a friend.
- Parameters
fileid – The id of the pausing file
- Throws
IllegalArgumentException – IOEXException
queryFriendFile¶
-
public void
queryFriendFile(String to, String filename, String message)¶ Query a file from a friend.
- Parameters
to – The target id
filename – target file name
message – The extra message
- Throws
IllegalArgumentException – IOEXException
removeFriend¶
-
public void
removeFriend(String userId)¶ Remove a friend. This function will remove a friend on this carrier node.
- Parameters
userId – The target user id to remove friendship
- Throws
IllegalArgumentException – IOEXException
replyFriendInvite¶
-
public void
replyFriendInvite(String to, int status, String reason, String data)¶ Reply the friend invite request. This function will send a invite response to friend.
- Parameters
to – The id who send invite request
status – The status code of the response. 0 is success, otherwise is error
reason – The error message if status is error, or null if success
data – The application defined data send to target user. If the status is error, this will be ignored
- Throws
IllegalArgumentException – IOEXException
resumeFriendCall¶
-
public void
resumeFriendCall(String friendId)¶ Resume a previously paused call. Only the client who paused the call can resume it.
- Parameters
friendId – Id of the friend.
- Throws
IllegalArgumentException – IOEXException
resumeFriendFile¶
-
public boolean
resumeFriendFile(String fileid)¶ Resume the process of sending/receiving a file to/from a friend.
- Parameters
fileid – The id of the resuming file
- Throws
IllegalArgumentException – IOEXException
scDownload¶
-
public void
scDownload(String fileid, String filename, String filepath)¶ Get files by content search
- Parameters
fileid – The file id
filename – The file name to be saved
filepath – The file path to be saved
- Throws
IllegalArgumentException – IOEXException
scUpload¶
-
public void
scUpload(String fileid, String filename, String filepath)¶ Upload files for content search
- Parameters
fileid – The file id
filename – The file name to be saved
filepath – The file path to be saved
- Throws
IllegalArgumentException – IOEXException
seekFriendFile¶
-
public void
seekFriendFile(String fileid, String position)¶ Seek a file from a friend.
- Parameters
fileid – The file id
position – The seeking position
- Throws
IllegalArgumentException – IOEXException
sendAudioFrame¶
-
public void
sendAudioFrame(String friendId, short[] pcm, int samples, int channels, int samplingRate)¶ Send an pcm-16bits encoded audio frame in the call with a friend. The expected format of the PCM data is: [s1c1][s1c2][…][s2c1][s2c2][…]… Meaning: sample 1 for channel 1, sample 1 for channel 2, … For mono audio, this has no meaning, every sample is subsequent. For stereo, this means the expected format is LRLRLR… with samples for left and right alternating.
- Parameters
friendId – ID of the friend.
pcm – An array of audio samples. The size of this array must be (samples * channels).
samples – Number of samples in this frame. It equals ((samplingRate)*(audio length)/1000). Audio length can be choose from 2.5, 5, 10, 20, 40 or 60 millseconds.
channels – Number of audio channels. Supported values are 1 (Mono) and 2 (Stereo).
samplingRate – Audio sampling rate in Hz used in this frame. Valid sampling rates are 8000, 12000, 16000, 24000, or 48000.
- Throws
IllegalArgumentException – IOEXException
sendFriendFile¶
-
public String
sendFriendFile(String to, String filename)¶ Send a file to a friend.
- Parameters
to – The target id
filename – The message content defined by application
- Throws
IllegalArgumentException – IOEXException
sendFriendMessage¶
-
public void
sendFriendMessage(String to, String message)¶ Send a message to a friend. The message length may not exceed MAX_APP_MESSAGE_LEN, and message itself should be text-formatted. Larger messages must be split by application and sent as separate messages. Other nodes can reassemble the fragments.
- Parameters
to – The target id
message – The message content defined by application
- Throws
IllegalArgumentException – IOEXException
sendFriendTunnelRequest¶
-
public int
sendFriendTunnelRequest(String to, String password)¶ Send tunnel request to a friend.
- Parameters
to – The target id
password – The shared secret
- Throws
IllegalArgumentException – IOEXException
sendVideoFrame¶
-
public void
sendVideoFrame(String friendId, int width, int height, byte[] y, byte[] u, byte[] v)¶ Send a raw YUV420 video frame in a call with a friend. This API requires Y, U and V planes separated and stored in byte array.
- Parameters
friendId – ID of the friend.
width – Width of the frame in pixels.
height – Height of the frame in pixels.
y – Y (Luminance) plane data. Size must be height * width.
u – U (Chroma) plane data. Size must be (height/2) * (width/2).
v – V (Chroma) plane data. Size must be (height/2) * (width/2).
- Throws
IllegalArgumentException – IOEXException
sendVideoFrame¶
-
public void
sendVideoFrame(String friendId, Image image)¶ Take an Android Image object and send it in a call with a friend. Currently, only support YUV420 format.
- Parameters
friendId – ID of the friend.
image – Image object to be sent.
- Throws
IllegalArgumentException – IOEXException
setFriendCallAudioBitrate¶
-
public void
setFriendCallAudioBitrate(String friendId, int bitrate)¶ Set our audio bit rate (in kbps) in an AV call. Usual numbers are 64, 96, 128 and 192, and the valid range is 6 ~ 510. Set 0 will disable our audio transmitting.
- Parameters
friendId – Id of the friend.
bitrate – Desired bitrate.
- Throws
IllegalArgumentException – IOEXException
setFriendCallAudioEnable¶
-
public void
setFriendCallAudioEnable(String friendId, boolean enable)¶ Enable or disable receiving audio from a friend in an AV call. Note that this API will not change our transmitting state, which means we could keep transmitting our AV data event if we disabled the friend’s.
- Parameters
friendId – Id of the friend.
enable – Enable or disable receiving audio.
- Throws
IllegalArgumentException – IOEXException
setFriendCallVideoBitrate¶
-
public void
setFriendCallVideoBitrate(String friendId, int bitrate)¶ Set our video bit rate (in kbps) in an AV call. Usually numbers are 400 ~ 14000, but any number can be considered valid. Set 0 will disable our video transmitting.
- Parameters
friendId – Id of the friend.
bitrate – Desired bitrate.
- Throws
IllegalArgumentException – IOEXException
setFriendCallVideoEnable¶
-
public void
setFriendCallVideoEnable(String friendId, boolean enable)¶ Enable or disable receiving video from a friend in an AV call. Note that this API will not change our transmitting state, which means we could keep transmitting our AV data event if we disabled the friend’s.
- Parameters
friendId – Id of the friend.
enable – Enable or disable receiving video.
- Throws
IllegalArgumentException – IOEXException
setNospam¶
-
public void
setNospam(int nospam)¶ Update self nospam of address for this carrier node. Update the nospam of carrier node address with host byte order expected. Nospam for Carrier address is used to eliminate spam friend request.
- Parameters
nospam – An integer value.
- Throws
IllegalArgumentException – IOEXException
setPresence¶
-
public void
setPresence(PresenceStatus presence)¶ Update self presence status.
- Parameters
presence – the new presence status.
- Throws
IllegalArgumentException – IOEXException
setSelfInfo¶
-
public void
setSelfInfo(UserInfo userinfo)¶ Update self user information. After self user information changed, carrier node will update this information to carrier network, and thereupon network broadcasts the change to all friends.
- Parameters
userinfo – The user information to update for this carrier node.
- Throws
IllegalArgumentException – IOEXException
start¶
-
public void
start(int iterateInterval)¶ Start carrier node asynchronously to connect to carrier network. If the connection to network is successful, carrier node starts working.
- Parameters
iterateInterval – Internal loop interval, in milliseconds.
writeTunnelDataLossless¶
-
public void
writeTunnelDataLossless(int tunnel_id, byte[] data, int length)¶ Send lossless data via a tunnel.
- Parameters
tunnel_id – The id of the tunnel
data – Buffer store the data
length – Size of the data in bytes
- Throws
IllegalArgumentException – IOEXException
writeTunnelDataLossy¶
-
public void
writeTunnelDataLossy(int tunnel_id, byte[] data, int length)¶ Send lossy data via a tunnel.
- Parameters
tunnel_id – The id of the tunnel
data – Buffer store the data
length – Size of the data in bytes
- Throws
IllegalArgumentException – IOEXException