Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1770,12 +1770,12 @@ public void onRequestSingle(String dataType) {
}

@Override
public void onPhotoRequest(String requestId, String appId, String webhookUrl, String size) {
Log.d(TAG, "Photo request received: requestId=" + requestId + ", appId=" + appId + ", webhookUrl=" + webhookUrl + ", size=" + size);
public void onPhotoRequest(String requestId, String packageName, String webhookUrl, String size) {
Log.d(TAG, "Photo request received: requestId=" + requestId + ", packageName=" + packageName + ", webhookUrl=" + webhookUrl + ", size=" + size);

// Forward the request to the smart glasses manager
if (smartGlassesManager != null) {
boolean requestSent = smartGlassesManager.requestPhoto(requestId, appId, webhookUrl, size);
boolean requestSent = smartGlassesManager.requestPhoto(requestId, packageName, webhookUrl, size);
if (!requestSent) {
Log.e(TAG, "Failed to send photo request to glasses");
}
Expand Down Expand Up @@ -1943,19 +1943,19 @@ public void onAudioPlayRequest(JSONObject audioRequest) {
public void onAudioStopRequest(JSONObject audioStopRequest) {
// Extract the audio stop request parameters
String sessionId = audioStopRequest.optString("sessionId", "");
String appId = audioStopRequest.optString("appId", "");
String packageName = audioStopRequest.optString("packageName", "");

// Send the audio stop request as a message to the AugmentOS Manager via BLE
if (blePeripheral != null) {
try {
JSONObject message = new JSONObject();
message.put("type", "audio_stop_request");
message.put("sessionId", sessionId);
message.put("appId", appId);
message.put("packageName", packageName);

// Send to AugmentOS Manager
blePeripheral.sendDataToAugmentOsManager(message.toString());
Log.d(TAG, "🔇 Forwarded audio stop request to manager from app: " + appId);
Log.d(TAG, "🔇 Forwarded audio stop request to manager from app: " + packageName);

} catch (JSONException e) {
Log.e(TAG, "Error creating audio stop request message for manager", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,18 +622,18 @@ public void sendPhotoResponse(String requestId, String photoUrl) {
/**
* Sends a video stream response message to the server
*
* @param appId The ID of the app requesting the stream
* @param packageName The ID of the app requesting the stream
* @param streamUrl URL of the video stream
*/
public void sendVideoStreamResponse(String appId, String streamUrl) {
public void sendVideoStreamResponse(String packageName, String streamUrl) {
try {
JSONObject event = new JSONObject();
event.put("type", "video_stream_response");
event.put("appId", appId);
event.put("packageName", packageName);
event.put("streamUrl", streamUrl);
event.put("timestamp", System.currentTimeMillis());
wsManager.sendText(event.toString());
Log.d(TAG, "Sent video stream response for appId: " + appId);
Log.d(TAG, "Sent video stream response for packageName: " + packageName);
} catch (JSONException e) {
Log.e(TAG, "Error building video_stream_response JSON", e);
}
Expand Down Expand Up @@ -737,14 +737,14 @@ private void handleIncomingMessage(JSONObject msg) {

case "photo_request":
String requestId = msg.optString("requestId");
String appId = msg.optString("appId");
String packageName = msg.optString("packageName");
String webhookUrl = msg.optString("webhookUrl", "");
String size = msg.optString("size", "medium");
Log.d(TAG, "Received photo_request, requestId: " + requestId + ", appId: " + appId + ", webhookUrl: " + webhookUrl + ", size: " + size);
if (serverCommsCallback != null && !requestId.isEmpty() && !appId.isEmpty()) {
serverCommsCallback.onPhotoRequest(requestId, appId, webhookUrl, size);
Log.d(TAG, "Received photo_request, requestId: " + requestId + ", packageName: " + packageName + ", webhookUrl: " + webhookUrl + ", size: " + size);
if (serverCommsCallback != null && !requestId.isEmpty() && !packageName.isEmpty()) {
serverCommsCallback.onPhotoRequest(requestId, packageName, webhookUrl, size);
} else {
Log.e(TAG, "Invalid photo request: missing requestId or appId");
Log.e(TAG, "Invalid photo request: missing requestId or packageName");
}
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public interface ServerCommsCallback {
* Called when the server requests a photo to be taken
*
* @param requestId Unique ID for this photo request
* @param appId ID of the app requesting the photo
* @param packageName ID of the app requesting the photo
* @param webhookUrl The webhook URL associated with the photo request
* @param size Requested photo size (small|medium|large)
*/
void onPhotoRequest(String requestId, String appId, String webhookUrl, String size);
void onPhotoRequest(String requestId, String packageName, String webhookUrl, String size);

/**
* Called when the server requests an RTMP stream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -966,20 +966,20 @@ public boolean sendCustomCommand(String commandJson) {
* Request a photo from the connected smart glasses
*
* @param requestId The unique ID for this photo request
* @param appId The ID of the app requesting the photo
* @param packageName The ID of the app requesting the photo
* @param webhookUrl The webhook URL where the photo should be uploaded directly
* @param size Requested photo size (small|medium|large)
* @return true if request was sent, false if glasses not connected
*/
public boolean requestPhoto(String requestId, String appId, String webhookUrl, String size) {
public boolean requestPhoto(String requestId, String packageName, String webhookUrl, String size) {
if (smartGlassesRepresentative != null &&
smartGlassesRepresentative.smartGlassesCommunicator != null &&
smartGlassesRepresentative.getConnectionState() == SmartGlassesConnectionState.CONNECTED) {

Log.d(TAG, "Requesting photo from glasses, requestId: " + requestId + ", appId: " + appId + ", webhookUrl: " + webhookUrl + ", size=" + size);
Log.d(TAG, "Requesting photo from glasses, requestId: " + requestId + ", packageName: " + packageName + ", webhookUrl: " + webhookUrl + ", size=" + size);

// Pass the request to the smart glasses communicator
smartGlassesRepresentative.smartGlassesCommunicator.requestPhoto(requestId, appId, webhookUrl, size);
smartGlassesRepresentative.smartGlassesCommunicator.requestPhoto(requestId, packageName, webhookUrl, size);
return true;
} else {
Log.e(TAG, "Cannot request photo - glasses not connected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1562,14 +1562,14 @@ private void processJsonMessage(JSONObject json) {
case "photo_response":
// Process photo response (success or failure)
String requestId = json.optString("requestId", "");
String appId = json.optString("appId", "");
String packageName = json.optString("packageName", "");
boolean photoSuccess = json.optBoolean("success", false);

if (!photoSuccess) {
// Handle failed photo response
String errorMsg = json.optString("error", "Unknown error");
Log.d(TAG, "Photo request failed - requestId: " + requestId +
", appId: " + appId + ", error: " + errorMsg);
", packageName: " + packageName + ", error: " + errorMsg);
} else {
// Handle successful photo (in future implementation)
Log.d(TAG, "Photo request succeeded - requestId: " + requestId);
Expand Down Expand Up @@ -2332,14 +2332,14 @@ public void changeSmartGlassesMicrophoneState(boolean enable) {
}

@Override
public void requestPhoto(String requestId, String appId, String webhookUrl, String size) {
Log.d(TAG, "Requesting photo: " + requestId + " for app: " + appId + " with webhookUrl: " + webhookUrl + ", size=" + size);
public void requestPhoto(String requestId, String packageName, String webhookUrl, String size) {
Log.d(TAG, "Requesting photo: " + requestId + " for app: " + packageName + " with webhookUrl: " + webhookUrl + ", size=" + size);

try {
JSONObject json = new JSONObject();
json.put("type", "take_photo");
json.put("requestId", requestId);
json.put("appId", appId);
json.put("packageName", packageName);
if (webhookUrl != null && !webhookUrl.isEmpty()) {
json.put("webhookUrl", webhookUrl);
}
Expand Down Expand Up @@ -2373,7 +2373,7 @@ public void requestRtmpStreamStart(JSONObject message) {
// try {
JSONObject json = message;
json.remove("timestamp");
json.remove("appId");
json.remove("packageName");
json.remove("video");
json.remove("audio");
//String rtmpUrl=json.getString("rtmpUrl");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ public void sendCustomCommand(String commandJson) {
* Requests the smart glasses to take a photo
*
* @param requestId The unique ID for this photo request
* @param appId The ID of the app requesting the photo
* @param packageName The ID of the app requesting the photo
* @param webhookUrl The webhook URL where the photo should be uploaded directly
*/
public void requestPhoto(String requestId, String appId, String webhookUrl, String size) {
public void requestPhoto(String requestId, String packageName, String webhookUrl, String size) {
// Default implementation does nothing
Log.d("SmartGlassesCommunicator", "Photo request (with size) not implemented for this device");
}
Expand All @@ -189,9 +189,9 @@ public void requestPhoto(String requestId, String appId, String webhookUrl, Stri
* Default implementation does nothing - specific communicators should override
*
* @param requestId The unique ID for this photo request
* @param appId The ID of the app requesting the photo
* @param packageName The ID of the app requesting the photo
*/
public void requestPhoto(String requestId, String appId) {
public void requestPhoto(String requestId, String packageName) {
// Default implementation does nothing
Log.d("SmartGlassesCommunicator", "Photo request not implemented for this device");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class MessageTypes {
public static final String PHOTO_RESPONSE = "photo_response";
public static final String PHOTO_REQUEST_ID = "requestId";
public static final String PHOTO_URL = "photoUrl";
public static final String PHOTO_APP_ID = "appId";
public static final String PHOTO_APP_ID = "packageName";

//VIDEO STREAM REQUEST

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ public class CommandSystem {

//command timeout
class AppPrivilegeTimeout {
public String appId;
public String packageName;
public long timeStart;

AppPrivilegeTimeout(String appId, long timeStart) {
this.appId = appId;
AppPrivilegeTimeout(String packageName, long timeStart) {
this.packageName = packageName;
this.timeStart = timeStart;
}
}
Expand Down Expand Up @@ -261,7 +261,7 @@ private boolean checkAppHasPrivilege(String eventId, String sendingPackage){
// }
//
// //if the app responded in good time (and it's the same app that was actually triggered, then allow the request
// if (sendingPackage.equals(appPrivilegeTimeout.appId)) {
// if (sendingPackage.equals(appPrivilegeTimeout.packageName)) {
// if ((System.currentTimeMillis() - appPrivilegeTimeout.timeStart) < commandResponseWindowTime) {
// return true;
// }
Expand Down
Loading
Loading