/** * Removes service record from the SDDB. * * @param handle hanlde of the service record to be deleted */ KNIEXPORT KNI_RETURNTYPE_VOID Java_com_sun_kvem_jsr082_bluetooth_SDDB_removeRecord(void) { javacall_bt_sddb_remove_record((bt_sddbid_t)KNI_GetParameterAsInt(1)); javacall_bt_stack_set_service_classes(javacall_bt_sddb_get_service_classes(0)); KNI_ReturnVoid(); }
/** * Creates or updates service record in the SDDB. * * @param handle handle of the service record to be updated; * if equals to 0, a new record will be created * @param classes device service classes associated with the record * @param data binary data containing attribute-value pairs in the format * identical to the one used in the AttributeList parameter of * the SDP_ServiceAttributeResponse PDU * @return service record handle, or 0 if the operation fails */ KNIEXPORT KNI_RETURNTYPE_INT Java_com_sun_kvem_jsr082_bluetooth_SDDB_updateRecord(void) { bt_sddbid_t retval; bt_record_t record; bt_sddbid_t old_id = (bt_sddbid_t)KNI_GetParameterAsInt(1); KNI_StartHandles(1); KNI_DeclareHandle(dataHandle); record.id = old_id; record.classes = KNI_GetParameterAsInt(2); KNI_GetParameterAsObject(3, dataHandle); record.data = JavaByteArray(dataHandle); record.size = KNI_GetArrayLength(dataHandle); if (javacall_bt_sddb_update_record(&record.id, record.classes, record.data, record.size) == JAVACALL_OK) { retval = record.id; if (old_id != BT_INVALID_SDDB_HANDLE) { bt_push_update_record(old_id, &record); } javacall_bt_stack_set_service_classes(javacall_bt_sddb_get_service_classes(0)); } else { retval = BT_INVALID_SDDB_HANDLE; } KNI_EndHandles(); KNI_ReturnInt(retval); }
javacall_result bt_push_unregister_url(const char *url) { bt_port_t port; bt_push_t *push, *prev; REPORT_INFO(LC_PUSH, "Bluetooth PushRegistry URL un-registration:"); REPORT_INFO1(LC_PUSH, "%s", url); bt_push_parse_url(url, &port, NULL); push = find_push(&port, &prev); if (push == NULL) { return JAVACALL_FAIL; } /* remove the service record */ javacall_bt_sddb_remove_record(push->record.id); /* close server and client connections */ close_all(push); /* remove the entry */ if (prev != NULL) { prev->next = push->next; } else { g_registry = push->next; } g_count--; pcsl_mem_free(push); push_save(); javacall_bt_stack_set_service_classes(javacall_bt_sddb_get_service_classes(0)); REPORT_INFO(LC_PUSH, "Un-registration successful."); return JAVACALL_OK; }
javacall_handle bt_push_start_server(const bt_port_t *port) { int psm, cn; bt_params_t *params; bt_push_t *push = find_push(port, NULL); if (push == NULL || push->server != BT_INVALID_HANDLE) { return BT_INVALID_HANDLE; } if (javacall_bt_sddb_update_record(&push->record.id, push->record.classes, push->record.data, push->record.size) != JAVACALL_OK) { return BT_INVALID_HANDLE; } params = &push->params; switch (port->protocol) { case BT_L2CAP: if (javacall_bt_l2cap_create_server(params->rmtu, params->tmtu, params->authenticate, params->authorize, params->encrypt, params->master, &push->server, &psm) != JAVACALL_OK) { return BT_INVALID_HANDLE; } javacall_bt_sddb_update_psm(push->record.id, psm); javacall_bt_l2cap_listen(push->server); break; case BT_SPP: case BT_GOEP: if (javacall_bt_rfcomm_create_server(params->authenticate, params->authorize, params->encrypt, params->master, &push->server, &cn) != JAVACALL_OK) { return BT_INVALID_HANDLE; } javacall_bt_sddb_update_channel(push->record.id, cn); javacall_bt_rfcomm_listen(push->server); break; default: return BT_INVALID_HANDLE; } javacall_bt_stack_set_service_classes(javacall_bt_sddb_get_service_classes(0)); return push->server; }
/** * Retrieves service classes of a record in the SDDB. * * @param handle handle of the service record * @return service classes set for the record */ KNIEXPORT KNI_RETURNTYPE_INT Java_com_sun_kvem_jsr082_bluetooth_SDDB_getServiceClasses(void) { KNI_ReturnInt(javacall_bt_sddb_get_service_classes(KNI_GetParameterAsInt(1))); }