Skip to content

Commit

Permalink
Merge pull request #420 from robotemi/dev_sprint_132
Browse files Browse the repository at this point in the history
sprint 132
  • Loading branch information
zjn0505 authored Nov 23, 2023
2 parents e2902cd + 7f825eb commit 825ecc1
Show file tree
Hide file tree
Showing 14 changed files with 368 additions and 27 deletions.
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.131.4
VERSION_NAME=1.132.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
104 changes: 93 additions & 11 deletions sample/src/main/java/com/robotemi/sdk/sample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ 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.tourguide.TourModel
import com.robotemi.sdk.voice.ITtsService
import com.robotemi.sdk.voice.model.TtsVoice
import kotlinx.android.synthetic.main.activity_main.*
Expand Down Expand Up @@ -338,6 +339,9 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
btnPublish.setOnClickListener { publishToActivityStream() }
btnHideTopBar.setOnClickListener { hideTopBar() }
btnShowTopBar.setOnClickListener { showTopBar() }
btnWakeup.setOnClickListener { wakeup() }
btnWakeupCustomLanguages.setOnClickListener { wakeupCustomLanguages() }
btnSetAsrLanguages.setOnClickListener { setAsrLanguages() }
btnDisableWakeup.setOnClickListener { disableWakeup() }
btnEnableWakeup.setOnClickListener { enableWakeup() }
btnToggleNavBillboard.setOnClickListener { toggleNavBillboard() }
Expand Down Expand Up @@ -393,7 +397,9 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
btnRequestToBeKioskApp.setOnClickListener { requestToBeKioskApp() }
btnStartDetectionModeWithDistance.setOnClickListener { startDetectionWithDistance() }
btnFetchSequence.setOnClickListener { getAllSequences() }
btnFetchTour.setOnClickListener { getAllTours() }
btnPlayFirstSequence.setOnClickListener { playFirstSequence() }
btnPlayFirstTour.setOnClickListener { playFirstTour() }
btnPlayFirstSequenceWithoutPlayer.setOnClickListener { playFirstSequenceWithoutPlayer() }
btnFetchMap.setOnClickListener { getMap() }
btnClearLog.setOnClickListener { clearLog() }
Expand Down Expand Up @@ -429,6 +435,34 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
}
}
}
btnCreateLinkBasedMeeting.setOnLongClickListener {
if (requestPermissionIfNeeded(Permission.MEETINGS, REQUEST_CODE_NORMAL)) {
// Permission not granted yet.
} else {
val request = LinkBasedMeeting(
topic = "temi Demo Meeting",
availability = LinkBasedMeeting.Availability(
start = Date(),
end = Date(Date().time + 86400000),
always = false,
),
limit = LinkBasedMeeting.Limit(
callDuration = LinkBasedMeeting.CallDuration.MINUTE_10,
usageLimit = LinkBasedMeeting.UsageLimit.NO_LIMIT,
),
permission = LinkBasedMeeting.Permission.DISABLE_ROBOT_INTERACTION,
security = LinkBasedMeeting.Security(
password = "1122334455", // Should use a 1 to 10-digits password.
hasPassword = false
)
)
thread {
val (code, linkUrl) = robot.createLinkBasedMeeting(request)
printLog("Link create request, response code $code, link $linkUrl")
}
}
true
}
btnStartPage.setOnClickListener { startPage() }
btnRestart.setOnClickListener { restartTemi() }
btnGetMembersStatus.setOnClickListener { getMembersStatus() }
Expand Down Expand Up @@ -1150,6 +1184,22 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
printLog("Locations updated :\n$locations")
}

private fun wakeup() {
robot.wakeup()
}

private fun wakeupCustomLanguages() {
robot.wakeup(listOf(SttLanguage.SYSTEM, SttLanguage.ZH_HK, SttLanguage.KO_KR))
}

private fun setAsrLanguages() {
if (!robot.isSelectedKioskApp()) {
return
}
val ret = robot.setAsrLanguages(listOf(SttLanguage.SYSTEM, SttLanguage.ZH_HK, SttLanguage.KO_KR))
printLog("setAsrLanguages: $ret")
}

private fun disableWakeup() {
if (requestPermissionIfNeeded(Permission.SETTINGS, REQUEST_CODE_NORMAL)) {
return
Expand Down Expand Up @@ -1191,9 +1241,10 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
* And also need to select this App as the Kiosk Mode App in Settings > App > Kiosk.
*
* @param asrResult The result of the ASR after waking up temi.
* @param sttLanguage The detected language of the ASR result, default is SYSTEM
</pre></pre> */
override fun onAsrResult(asrResult: String) {
printLog("onAsrResult", "asrResult = $asrResult")
override fun onAsrResult(asrResult: String, sttLanguage: SttLanguage) {
printLog("onAsrResult", "asrResult = $asrResult, sttLanguage = $sttLanguage")
try {
val metadata = packageManager
.getApplicationInfo(packageName, PackageManager.GET_META_DATA).metaData
Expand Down Expand Up @@ -1596,8 +1647,11 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
if (imageKey.isEmpty()) continue
imageKeys.add(imageKey)
}
val pairs = if (imageKeys.isEmpty()) emptyList()
else robot.getSignedUrlByMediaKey(imageKeys)
val pairs = if (imageKeys.isEmpty()) {
emptyList()
} else {
robot.getSignedUrlByMediaKey(imageKeys)
}
runOnUiThread {
for (sequenceModel in allSequences) {
printLog(sequenceModel.toString())
Expand Down Expand Up @@ -1633,6 +1687,34 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
}
}

@Volatile
private var allTours: List<TourModel> = emptyList()

private fun getAllTours() {
if (requestPermissionIfNeeded(Permission.SEQUENCE, REQUEST_CODE_SEQUENCE_FETCH_ALL)) {
return
}
Thread {
allTours = robot.getAllTours()
printLog("allTours: ${allTours.size}", false)
runOnUiThread {
for (tourGuide in allTours) {
printLog(tourGuide.toString())
}
}
}.start()
}

private fun playFirstTour() {
if (requestPermissionIfNeeded(Permission.SEQUENCE, REQUEST_CODE_SEQUENCE_PLAY)) {
return
}
if (allTours.isNotEmpty()) {
val ret = robot.playTour(allTours[0].id)
printLog("playTour: $ret")
}
}

private fun getMap() {
if (requestPermissionIfNeeded(Permission.MAP, REQUEST_CODE_MAP)) {
return
Expand Down Expand Up @@ -1663,19 +1745,19 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
2 -> {
Log.d(
"SAMPLE_DEBUG",
"VISITOR - onFaceRecognized ${contactModel.userId}, similarity ${contactModel.similarity}, age ${contactModel.age}, gender ${contactModel.gender}"
"VISITOR - onFaceRecognized ${contactModel.userId}, similarity ${contactModel.similarity}, age ${contactModel.age}, gender ${contactModel.gender}, faceRect ${contactModel.faceRect}"
)
printLog("onFaceRecognized: VISITOR ${contactModel.userId} ${contactModel.similarity}")
}
3 -> {
Log.d(
"SAMPLE_DEBUG",
"SDK Face - onFaceRecognized ${contactModel.userId}, ${contactModel.firstName}, similarity ${contactModel.similarity}, age ${contactModel.age}, gender ${contactModel.gender}"
"SDK Face - onFaceRecognized ${contactModel.userId}, ${contactModel.firstName}, similarity ${contactModel.similarity}, age ${contactModel.age}, gender ${contactModel.gender}, faceRect ${contactModel.faceRect}"
)
printLog("onFaceRecognized: SDK Face ${contactModel.userId}, ${contactModel.firstName}, similarity ${contactModel.similarity}, age ${contactModel.age}, gender ${contactModel.gender}")
printLog("onFaceRecognized: SDK Face ${contactModel.userId}, ${contactModel.firstName}, similarity ${contactModel.similarity}, age ${contactModel.age}, gender ${contactModel.gender}, faceRect ${contactModel.faceRect}")
}
-1 -> {
printLog("onFaceRecognized: Unknown face, faceId ${contactModel.userId}, age ${contactModel.age}, gender ${contactModel.gender}")
printLog("onFaceRecognized: Unknown face, faceId ${contactModel.userId}, age ${contactModel.age}, gender ${contactModel.gender}, faceRect ${contactModel.faceRect}")
}
}
}
Expand Down Expand Up @@ -1709,19 +1791,19 @@ class MainActivity : AppCompatActivity(), NlpListener, OnRobotReadyListener,
2 -> {
Log.d(
"SAMPLE_DEBUG",
"VISITOR - onContinuousFaceRecognized ${contactModel.userId}, similarity ${contactModel.similarity}, age ${contactModel.age}, gender ${contactModel.gender}"
"VISITOR - onContinuousFaceRecognized ${contactModel.userId}, similarity ${contactModel.similarity}, age ${contactModel.age}, gender ${contactModel.gender}, faceRect ${contactModel.faceRect}"
)
"$blinker VISITOR ${contactModel.userId} similarity ${contactModel.similarity}\n"
}
3 -> {
Log.d(
"SAMPLE_DEBUG",
"SDK Face - onContinuousFaceRecognized ${contactModel.userId}, similarity ${contactModel.similarity}, age ${contactModel.age}, gender ${contactModel.gender}"
"SDK Face - onContinuousFaceRecognized ${contactModel.userId}, similarity ${contactModel.similarity}, age ${contactModel.age}, gender ${contactModel.gender}, faceRect ${contactModel.faceRect}"
)
"$blinker SDK Face ${contactModel.userId} -> ${contactModel.firstName}, similarity ${contactModel.similarity}\n"
}
else -> {
"$blinker Unknown face, faceId ${contactModel.userId}, age ${contactModel.age}, gender ${contactModel.gender}\n"
"$blinker Unknown face, faceId ${contactModel.userId}, age ${contactModel.age}, gender ${contactModel.gender}, faceRect ${contactModel.faceRect}\n"
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions sample/src/main/res/layout/group_resources.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
style="@style/ButtonCommon"
android:text="Get All Sequences" />

<Button
android:id="@+id/btnFetchTour"
style="@style/ButtonCommon"
android:text="Get All Tours" />

<Button
android:id="@+id/btnPlayFirstSequenceWithoutPlayer"
style="@style/ButtonCommon"
Expand All @@ -52,6 +57,11 @@
style="@style/ButtonCommon"
android:text="Play First Sequence" />

<Button
android:id="@+id/btnPlayFirstTour"
style="@style/ButtonCommon"
android:text="Play First Tour" />

<Button
android:id="@+id/btnGetOSVersion"
style="@style/ButtonCommon"
Expand Down
15 changes: 15 additions & 0 deletions sample/src/main/res/layout/group_settings_and_status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,21 @@
style="@style/ButtonCommon"
android:text="Set Volume" />

<Button
android:id="@+id/btnWakeup"
style="@style/ButtonCommon"
android:text="Wakeup" />

<Button
android:id="@+id/btnWakeupCustomLanguages"
style="@style/ButtonCommon"
android:text="Wakeup with Custom Languages" />

<Button
android:id="@+id/btnSetAsrLanguages"
style="@style/ButtonCommon"
android:text="Set ASR Languages" />

<Button
android:id="@+id/btnDisableWakeup"
style="@style/ButtonCommon"
Expand Down
11 changes: 9 additions & 2 deletions sdk/src/main/aidl/com/robotemi/sdk/ISdkService.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ 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.tourguide.TourModel;
import com.robotemi.sdk.navigation.model.Position;
import com.robotemi.sdk.map.MapDataModel;
import com.robotemi.sdk.model.MemberStatusModel;
Expand Down Expand Up @@ -172,7 +173,7 @@ interface ISdkService {
*/
boolean deleteLocation(in String name);

void wakeup();
void wakeup(in int[] languages);

String getWakeupWord();

Expand Down Expand Up @@ -358,7 +359,13 @@ interface ISdkService {

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

String startMeeting(in String packageName, in List<Participant> participants, boolean firstParticipantJoinedAsHost);
String startMeeting(in String packageName, in List<Participant> participants, boolean firstParticipantJoinedAsHost, boolean blockRobotInteraction);

int configMinimumObstacleDistance(in String packageName, int value);

List<TourModel> getAllTours(in String packageName, in List<String> tags);

int playTour(in String packageName, in String tourId);

int setAsrLanguages(in String packageName, in int[] languages);
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ interface ISdkServiceCallback {

boolean onDetectionStateChanged(in int state);

boolean onAsrResult(in String asrText);
boolean onAsrResult(in String asrText, in int language);

boolean onTelepresenceEventChanged(in CallEventModel callEventModel);

Expand Down
4 changes: 4 additions & 0 deletions sdk/src/main/aidl/com/robotemi/sdk/tourguide/TourModel.aidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// TourModel.aidl
package com.robotemi.sdk.tourguide;

parcelable TourModel;
Loading

0 comments on commit 825ecc1

Please sign in to comment.