/*
* Copyright (c) 2020-2023 ndeadly
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "btdrv_shim.h"
#include
Result btdrvInitializeBluetoothFwd(Service* srv, Handle *out_handle) {
return serviceMitmDispatch(srv, 1,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = out_handle,
);
}
Result btdrvEnableBluetoothFwd(Service* srv) {
return serviceMitmDispatch(srv, 2);
}
Result btdrvInitializeHidFwd(Service* srv, Handle *out_handle, u16 version) {
return serviceMitmDispatchIn(srv, 16, version,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = out_handle,
);
}
Result btdrvWriteHidDataFwd(Service* srv, const BtdrvAddress *address, const BtdrvHidReport *report) {
return serviceMitmDispatchIn(srv, 19, *address,
.buffer_attrs = { SfBufferAttr_FixedSize | SfBufferAttr_HipcPointer | SfBufferAttr_In },
.buffers = { {report, sizeof(BtdrvHidReport)} }
);
}
Result btdrvWriteHidData2Fwd(Service* srv, const BtdrvAddress *address, const void *data, size_t size) {
return serviceMitmDispatchIn(srv, 20, *address,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
.buffers = { {data, size} }
);
}
Result btdrvRegisterHidReportEventFwd(Service* srv, Handle *out_handle) {
return serviceMitmDispatch(srv, hosversionBefore(4, 0, 0) ? 36 : 37,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = out_handle,
);
}
Result btdrvGetHidReportEventInfoFwd(Service* srv, Handle *out_handle) {
return serviceMitmDispatch(srv, 38,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = out_handle,
);
}
Result btdrvInitializeBleFwd(Service* srv, Handle *out_handle) {
return serviceMitmDispatch(srv, 46,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = out_handle,
);
}