1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.bluetooth.mapclient; 18 19 import java.io.IOException; 20 21 import javax.obex.ClientSession; 22 import javax.obex.HeaderSet; 23 24 final class RequestSetMessageStatus extends Request { 25 public enum StatusIndicator { READ, DELETED } 26 27 private static final String TYPE = "x-bt/messageStatus"; 28 RequestSetMessageStatus(String handle, StatusIndicator statusInd)29 public RequestSetMessageStatus(String handle, StatusIndicator statusInd) { 30 mHeaderSet.setHeader(HeaderSet.TYPE, TYPE); 31 mHeaderSet.setHeader(HeaderSet.NAME, handle); 32 33 ObexAppParameters oap = new ObexAppParameters(); 34 oap.add(OAP_TAGID_STATUS_INDICATOR, 35 statusInd == StatusIndicator.READ ? STATUS_INDICATOR_READ 36 : STATUS_INDICATOR_DELETED); 37 oap.add(OAP_TAGID_STATUS_VALUE, STATUS_YES); 38 oap.addToHeaderSet(mHeaderSet); 39 } 40 41 @Override execute(ClientSession session)42 public void execute(ClientSession session) throws IOException { 43 executePut(session, FILLER_BYTE); 44 } 45 } 46