Java Code Examples for javax.bluetooth.DataElement#addElement()
The following examples show how to use
javax.bluetooth.DataElement#addElement() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServiceRecordSerializer.java From pluotsorbet with GNU General Public License v2.0 | 6 votes |
public static synchronized byte[] serialize(ServiceRecord record) { DataElement seq = new DataElement(DataElement.DATSEQ); int[] attrIDs = record.getAttributeIDs(); for (int i = 0; i < attrIDs.length; i++) { DataElement attrID = new DataElement(DataElement.U_INT_2, attrIDs[i]); DataElement attrValue = record.getAttributeValue(attrIDs[i]); if (attrValue != null) { seq.addElement(attrID); seq.addElement(attrValue); } } try { return des.serialize(seq); } catch (IOException e) { return null; } }
Example 2
Source File: ClientServiceSearchAttributeTransaction.java From pluotsorbet with GNU General Public License v2.0 | 6 votes |
public ClientServiceSearchAttributeTransaction(JavaSDPClient client, int transactionID, SDPResponseListener listener, int[] attrSet, UUID[] uuidSet) { super(client, SDPClientTransaction.SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST, transactionID, listener); attrData = new DataElement(DataElement.DATSEQ); uuidData = new DataElement(DataElement.DATSEQ); for (int i = 0; i < attrSet.length; i++) { attrData.addElement(new DataElement(DataElement.U_INT_2, attrSet[i])); } for (int i = 0; i < uuidSet.length; i++) { uuidData.addElement(new DataElement(DataElement.UUID, uuidSet[i])); } parameterLength = super.client.getConnection().getReaderWriter().getDataSize(attrData) + super.client.getConnection().getReaderWriter().getDataSize(uuidData) + 2; }
Example 3
Source File: ServiceRecordImpl.java From pluotsorbet with GNU General Public License v2.0 | 5 votes |
private DataElement dataElementCopy(DataElement original) { if ((original.getDataType() == DataElement.DATSEQ) || (original.getDataType() == DataElement.DATALT)) { DataElement copy = new DataElement(original.getDataType()); Enumeration elements = (Enumeration) original.getValue(); while (elements.hasMoreElements()) { copy.addElement(dataElementCopy((DataElement) elements.nextElement())); } return copy; } else { return original; } }
Example 4
Source File: ClientServiceSearchTransaction.java From pluotsorbet with GNU General Public License v2.0 | 5 votes |
public ClientServiceSearchTransaction(JavaSDPClient client, int transactionID, SDPResponseListener listener, UUID[] uuidSet) { super(client, SDPClientTransaction.SDP_SERVICE_SEARCH_REQUEST, transactionID, listener); serviceSearchPattern = new DataElement(DataElement.DATSEQ); for (int i = 0; i < uuidSet.length; i++) { serviceSearchPattern.addElement(new DataElement( DataElement.UUID, uuidSet[i])); } parameterLength = super.des.getDataSize(serviceSearchPattern) + 2; }
Example 5
Source File: ClientServiceAttributeTransaction.java From pluotsorbet with GNU General Public License v2.0 | 5 votes |
ClientServiceAttributeTransaction(JavaSDPClient client, int transactionID, SDPResponseListener listener, int recordHandle, int[] attrSet) { super(client, SDPClientTransaction.SDP_SERVICE_ATTRIBUTE_REQUEST, transactionID, listener); serviceRecordHandle = recordHandle; attributeIDList = new DataElement(DataElement.DATSEQ); for (int i = 0; i < attrSet.length; i++) { attributeIDList.addElement(new DataElement( DataElement.U_INT_2, attrSet[i])); } parameterLength = super.client.getConnection().getReaderWriter().getDataSize(attributeIDList) + 6; }