Skip to content

Commit

Permalink
Merge pull request #392 from robotemi/sprint_131/add_meeting_et_ee
Browse files Browse the repository at this point in the history
Sprint 131
  • Loading branch information
zjn0505 authored Jun 13, 2023
2 parents eed8543 + 2b1230a commit 1205899
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Download

Download the latest AAR from [Maven Central][2] or grab via Gradle:
```groovy
implementation 'com.robotemi:sdk:1.130.4'
implementation 'com.robotemi:sdk:1.131.0'
```

or Maven:
```xml
<dependency>
<groupId>com.robotemi</groupId>
<artifactId>sdk</artifactId>
<version>1.130.4</version>
<version>1.131.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android.enableJetifier=true
kotlin.code.style=official

GROUP=com.robotemi
VERSION_NAME=1.130.4
VERSION_NAME=1.131.0
POM_URL=https://github.com/robotemi/sdk/
POM_SCM_URL=https://github.com/robotemi/sdk/
POM_SCM_CONNECTION=scm:git:git://github.com/robotemi/sdk.git
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ dependencies {

// temi SDK
implementation project(':sdk')
// implementation 'com.robotemi:sdk:1.130.3'
// implementation 'com.robotemi:sdk:1.130.4'
implementation 'com.google.code.gson:gson:2.9.0'
}
19 changes: 18 additions & 1 deletion sample/src/main/java/com/robotemi/sdk/sample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import com.robotemi.sdk.sequence.OnSequencePlayStatusChangedListener
import com.robotemi.sdk.sequence.SequenceModel
import com.robotemi.sdk.telepresence.CallState
import com.robotemi.sdk.telepresence.LinkBasedMeeting
import com.robotemi.sdk.telepresence.Participant
import com.robotemi.sdk.voice.ITtsService
import com.robotemi.sdk.voice.model.TtsVoice
import kotlinx.android.synthetic.main.activity_main.*
Expand Down Expand Up @@ -391,6 +392,7 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
btnGetAllContacts.setOnClickListener { getAllContacts() }
btnGoToPosition.setOnClickListener { goToPosition() }
btnStartTelepresenceToCenter.setOnClickListener { startTelepresenceToCenter() }
btnStartMeeting.setOnClickListener { startMeeting() }
btnCreateLinkBasedMeeting.setOnClickListener {
if (requestPermissionIfNeeded(Permission.MEETINGS, REQUEST_CODE_NORMAL)) {
// Permission not granted yet.
Expand Down Expand Up @@ -1006,7 +1008,8 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
* stopCall is an example of how to stop call an individual.
*/
private fun stopCall() {
robot.stopTelepresence()
val ret = robot.stopTelepresence()
printLog("stopTelepresence()", "Result $ret.")
}

/**
Expand Down Expand Up @@ -1753,6 +1756,19 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
robot.startTelepresence(target.name, target.userId, Platform.TEMI_CENTER)
}

private fun startMeeting() {
val target = robot.adminInfo
if (target == null) {
printLog("target is null.")
return
}
val resp = robot.startMeeting(listOf(
Participant(target.userId, Platform.MOBILE),
Participant(target.userId, Platform.TEMI_CENTER),
))
Log.d("MainActivity", "startMeeting result $resp")
}

private fun startPage() {
val systemPages: MutableList<String> = ArrayList()
for (page in Page.values()) {
Expand Down Expand Up @@ -2030,6 +2046,7 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
TtsRequest.Language.ES_ES -> Locale("es", "ES")
TtsRequest.Language.CA_ES -> Locale("ca", "ES")
TtsRequest.Language.HI_IN -> Locale("hi", "IN")
TtsRequest.Language.ET_EE -> Locale("et", "EE")
else -> if (robot.launcherVersion.contains("china")) {
Locale.SIMPLIFIED_CHINESE
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class TemiBroadcastReceiver : BroadcastReceiver() {
const val ACTION_DEBUG = "temi.debug.sdk"
private const val ACTION_START_STAND_BY = "temi.debug.standby.start"
private const val ACTION_STOP_STAND_BY = "temi.debug.standby.stop"
private const val ACTION_ENABLE_STAND_BY = "temi.debug.standby.enable"
private const val ACTION_TTS = "temi.debug.tts"
private const val ACTION_MULTI_FLOOR = "temi.debug.multi.floor"
private const val ACTION_SEQUENCE = "temi.debug.sequence"
Expand Down Expand Up @@ -40,6 +41,14 @@ class TemiBroadcastReceiver : BroadcastReceiver() {
val result = Robot.getInstance().stopStandBy(password)
Log.d("TemiBroadcastReceiver", "stopStandBy, $result")
}
ACTION_ENABLE_STAND_BY -> {
// adb shell am broadcast -a temi.debug.sdk --es action "temi.debug.standby.enable" --ez enable true --es password "1234"
val enabled = intent.getBooleanExtra("enable", false)
val password = intent.getStringExtra("password") ?: ""
Log.d("TemiBroadcastReceiver", "enableStandBy, ${Robot.getInstance().isStandByOn()}, enable $enabled, password $password")
val result = Robot.getInstance().enableStandBy(enabled, password)
Log.d("TemiBroadcastReceiver", "enableStandBy, $result")
}
ACTION_TTS -> {
// adb shell am broadcast -a temi.debug.sdk --es action "temi.debug.tts" --ez random true --es language "EN_US" --ez cache true --es text "hello"
val random = intent.getBooleanExtra("random", false)
Expand Down
5 changes: 5 additions & 0 deletions sample/src/main/res/layout/group_resources.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
style="@style/ButtonCommon"
android:text="Start Telepresence to temi Center" />

<Button
android:id="@+id/btnStartMeeting"
style="@style/ButtonCommon"
android:text="Start Meeting with Mobile and Center" />

<Button
android:id="@+id/btnCreateLinkBasedMeeting"
style="@style/ButtonCommon"
Expand Down
5 changes: 5 additions & 0 deletions sdk/src/main/aidl/com/robotemi/sdk/ISdkService.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.robotemi.sdk.UserInfo;
import com.robotemi.sdk.model.RecentCallModel;
import com.robotemi.sdk.BatteryData;
import com.robotemi.sdk.sequence.SequenceModel;
import com.robotemi.sdk.telepresence.Participant;
import com.robotemi.sdk.navigation.model.Position;
import com.robotemi.sdk.map.MapDataModel;
import com.robotemi.sdk.model.MemberStatusModel;
Expand Down Expand Up @@ -354,4 +355,8 @@ interface ISdkService {
String createLinkBasedMeeting(in String packageName, in String json);

int stopTelepresence(String packageName);

int enableStandBy(in String packageName, boolean enabled, in String password);

String startMeeting(in String packageName, in List<Participant> participants);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Participant.aidl
package com.robotemi.sdk.telepresence;

parcelable Participant;
32 changes: 32 additions & 0 deletions sdk/src/main/java/com/robotemi/sdk/Robot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import com.robotemi.sdk.sequence.SequenceModel
import com.robotemi.sdk.sequence.compatible
import com.robotemi.sdk.telepresence.CallState
import com.robotemi.sdk.telepresence.LinkBasedMeeting
import com.robotemi.sdk.telepresence.Participant
import com.robotemi.sdk.voice.ITtsService
import com.robotemi.sdk.voice.model.TtsVoice
import org.json.JSONException
Expand Down Expand Up @@ -1615,6 +1616,23 @@ class Robot private constructor(private val context: Context) {
return emptyList()
}

/**
* Start a video call to the temi user.
*
* @param participants list of user names and peer ids.
* @return
*/
fun startMeeting(
participants: List<Participant>
): String {
try {
return sdkService?.startMeeting(applicationInfo.packageName, participants) ?: ""
} catch (e: RemoteException) {
Log.e(TAG, "startMeeting() error")
}
return ""
}

/**
* Start listening for Telepresence Status changes.
*
Expand Down Expand Up @@ -2157,6 +2175,20 @@ class Robot private constructor(private val context: Context) {
return sdkService?.stopStandBy(applicationInfo.packageName, password) ?: -1
}

/**
* Enable/Disable StandBy
* Require Permission.SETTINGS Permission, Require password to stop standBy if password has been set.
* @return -1 robot is not ready.
* 0 operation failed.
* 2 for password required
* 3 for wrong password
* 403 SETTINGS permission required
* 429 for too many requests, should be longer than 5 seconds between 2 calls
*/
fun enableStandBy(enabled: Boolean, password: String = ""): Int {
return sdkService?.enableStandBy(applicationInfo.packageName, enabled, password) ?: -1
}

/**
* Get the supported latin keyboards
*
Expand Down
4 changes: 3 additions & 1 deletion sdk/src/main/java/com/robotemi/sdk/TtsRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ data class TtsRequest(
SYSTEM(0), EN_US(1), ZH_CN(2), ZH_HK(3), ZH_TW(4), TH_TH(5),
HE_IL(6), KO_KR(7), JA_JP(8), IN_ID(9), ID_ID(10), DE_DE(11),
FR_FR(12), FR_CA(13), PT_BR(14), AR_EG(15), AR_AE(16), AR_XA(17),
RU_RU(18), IT_IT(19), PL_PL(20), ES_ES(21), CA_ES(22), HI_IN(23);
RU_RU(18), IT_IT(19), PL_PL(20), ES_ES(21), CA_ES(22), HI_IN(23),
ET_EE(24);

companion object {

Expand Down Expand Up @@ -100,6 +101,7 @@ data class TtsRequest(
21 -> ES_ES
22 -> CA_ES
23 -> HI_IN
24 -> ET_EE
else -> SYSTEM
}
}
Expand Down
37 changes: 37 additions & 0 deletions sdk/src/main/java/com/robotemi/sdk/telepresence/Participant.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.robotemi.sdk.telepresence

import android.os.Parcel
import android.os.Parcelable
import com.robotemi.sdk.constants.Platform

data class Participant(
val peerId: String,
val platform: Int,
) : Parcelable {

constructor(peerId: String, platform: Platform) : this(peerId, platform.value)

constructor(parcel: Parcel) : this(
parcel.readString()!!,
parcel.readInt()
)

override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(peerId)
parcel.writeInt(platform)
}

override fun describeContents(): Int {
return 0
}

companion object CREATOR : Parcelable.Creator<Participant> {
override fun createFromParcel(parcel: Parcel): Participant {
return Participant(parcel)
}

override fun newArray(size: Int): Array<Participant?> {
return arrayOfNulls(size)
}
}
}

0 comments on commit 1205899

Please sign in to comment.