|
|
@ -183,8 +183,8 @@ private:
|
|
|
|
|
|
|
|
|
|
|
|
/// Wraps the payload into packet and puts it to the receive buffer
|
|
|
|
/// Wraps the payload into packet and puts it to the receive buffer
|
|
|
|
void IR_USER::PutToReceive(const std::vector<u8>& payload) {
|
|
|
|
void IR_USER::PutToReceive(const std::vector<u8>& payload) {
|
|
|
|
LOG_TRACE(Service_IR, "called, data=%s",
|
|
|
|
NGLOG_TRACE(Service_IR, "called, data={}",
|
|
|
|
Common::ArrayToString(payload.data(), payload.size()).c_str());
|
|
|
|
Common::ArrayToString(payload.data(), payload.size()));
|
|
|
|
size_t size = payload.size();
|
|
|
|
size_t size = payload.size();
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<u8> packet;
|
|
|
|
std::vector<u8> packet;
|
|
|
@ -225,7 +225,7 @@ void IR_USER::PutToReceive(const std::vector<u8>& payload) {
|
|
|
|
if (receive_buffer->Put(packet)) {
|
|
|
|
if (receive_buffer->Put(packet)) {
|
|
|
|
receive_event->Signal();
|
|
|
|
receive_event->Signal();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
LOG_ERROR(Service_IR, "receive buffer is full!");
|
|
|
|
NGLOG_ERROR(Service_IR, "receive buffer is full!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -251,10 +251,10 @@ void IR_USER::InitializeIrNopShared(Kernel::HLERequestContext& ctx) {
|
|
|
|
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
|
|
|
|
LOG_INFO(Service_IR,
|
|
|
|
NGLOG_INFO(Service_IR,
|
|
|
|
"called, shared_buff_size=%u, recv_buff_size=%u, "
|
|
|
|
"called, shared_buff_size={}, recv_buff_size={}, "
|
|
|
|
"recv_buff_packet_count=%u, send_buff_size=%u, "
|
|
|
|
"recv_buff_packet_count={}, send_buff_size={}, "
|
|
|
|
"send_buff_packet_count=%u, baud_rate=%u",
|
|
|
|
"send_buff_packet_count={}, baud_rate={}",
|
|
|
|
shared_buff_size, recv_buff_size, recv_buff_packet_count, send_buff_size,
|
|
|
|
shared_buff_size, recv_buff_size, recv_buff_packet_count, send_buff_size,
|
|
|
|
send_buff_packet_count, baud_rate);
|
|
|
|
send_buff_packet_count, baud_rate);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -275,7 +275,7 @@ void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) {
|
|
|
|
connected_device->OnConnect();
|
|
|
|
connected_device->OnConnect();
|
|
|
|
conn_status_event->Signal();
|
|
|
|
conn_status_event->Signal();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
LOG_WARNING(Service_IR, "unknown device id %u. Won't connect.", device_id);
|
|
|
|
NGLOG_WARNING(Service_IR, "unknown device id {}. Won't connect.", device_id);
|
|
|
|
shared_memory_ptr[offsetof(SharedMemoryHeader, connection_status)] = 1;
|
|
|
|
shared_memory_ptr[offsetof(SharedMemoryHeader, connection_status)] = 1;
|
|
|
|
shared_memory_ptr[offsetof(SharedMemoryHeader, trying_to_connect_status)] = 2;
|
|
|
|
shared_memory_ptr[offsetof(SharedMemoryHeader, trying_to_connect_status)] = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -283,7 +283,7 @@ void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
|
|
|
|
LOG_INFO(Service_IR, "called, device_id = %u", device_id);
|
|
|
|
NGLOG_INFO(Service_IR, "called, device_id = {}", device_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) {
|
|
|
|
void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) {
|
|
|
@ -292,7 +292,7 @@ void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) {
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushCopyObjects(receive_event);
|
|
|
|
rb.PushCopyObjects(receive_event);
|
|
|
|
|
|
|
|
|
|
|
|
LOG_INFO(Service_IR, "called");
|
|
|
|
NGLOG_INFO(Service_IR, "called");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IR_USER::GetSendEvent(Kernel::HLERequestContext& ctx) {
|
|
|
|
void IR_USER::GetSendEvent(Kernel::HLERequestContext& ctx) {
|
|
|
@ -301,7 +301,7 @@ void IR_USER::GetSendEvent(Kernel::HLERequestContext& ctx) {
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushCopyObjects(send_event);
|
|
|
|
rb.PushCopyObjects(send_event);
|
|
|
|
|
|
|
|
|
|
|
|
LOG_INFO(Service_IR, "called");
|
|
|
|
NGLOG_INFO(Service_IR, "called");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IR_USER::Disconnect(Kernel::HLERequestContext& ctx) {
|
|
|
|
void IR_USER::Disconnect(Kernel::HLERequestContext& ctx) {
|
|
|
@ -318,7 +318,7 @@ void IR_USER::Disconnect(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb(ctx, 0x09, 1, 0);
|
|
|
|
IPC::RequestBuilder rb(ctx, 0x09, 1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
|
|
|
|
LOG_INFO(Service_IR, "called");
|
|
|
|
NGLOG_INFO(Service_IR, "called");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IR_USER::GetConnectionStatusEvent(Kernel::HLERequestContext& ctx) {
|
|
|
|
void IR_USER::GetConnectionStatusEvent(Kernel::HLERequestContext& ctx) {
|
|
|
@ -327,7 +327,7 @@ void IR_USER::GetConnectionStatusEvent(Kernel::HLERequestContext& ctx) {
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushCopyObjects(conn_status_event);
|
|
|
|
rb.PushCopyObjects(conn_status_event);
|
|
|
|
|
|
|
|
|
|
|
|
LOG_INFO(Service_IR, "called");
|
|
|
|
NGLOG_INFO(Service_IR, "called");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IR_USER::FinalizeIrNop(Kernel::HLERequestContext& ctx) {
|
|
|
|
void IR_USER::FinalizeIrNop(Kernel::HLERequestContext& ctx) {
|
|
|
@ -342,7 +342,7 @@ void IR_USER::FinalizeIrNop(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestBuilder rb(ctx, 0x02, 1, 0);
|
|
|
|
IPC::RequestBuilder rb(ctx, 0x02, 1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
|
|
|
|
|
|
|
|
LOG_INFO(Service_IR, "called");
|
|
|
|
NGLOG_INFO(Service_IR, "called");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) {
|
|
|
|
void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) {
|
|
|
@ -357,12 +357,12 @@ void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) {
|
|
|
|
send_event->Signal();
|
|
|
|
send_event->Signal();
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
LOG_ERROR(Service_IR, "not connected");
|
|
|
|
NGLOG_ERROR(Service_IR, "not connected");
|
|
|
|
rb.Push(ResultCode(static_cast<ErrorDescription>(13), ErrorModule::IR,
|
|
|
|
rb.Push(ResultCode(static_cast<ErrorDescription>(13), ErrorModule::IR,
|
|
|
|
ErrorSummary::InvalidState, ErrorLevel::Status));
|
|
|
|
ErrorSummary::InvalidState, ErrorLevel::Status));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LOG_TRACE(Service_IR, "called, data=%s", Common::ArrayToString(buffer.data(), size).c_str());
|
|
|
|
NGLOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(buffer.data(), size));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
|
|
|
|
void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
|
|
|
@ -374,12 +374,12 @@ void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
|
|
|
|
if (receive_buffer->Release(count)) {
|
|
|
|
if (receive_buffer->Release(count)) {
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
LOG_ERROR(Service_IR, "failed to release %u packets", count);
|
|
|
|
NGLOG_ERROR(Service_IR, "failed to release {} packets", count);
|
|
|
|
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::IR, ErrorSummary::NotFound,
|
|
|
|
rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::IR, ErrorSummary::NotFound,
|
|
|
|
ErrorLevel::Status));
|
|
|
|
ErrorLevel::Status));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LOG_TRACE(Service_IR, "called, count=%u", count);
|
|
|
|
NGLOG_TRACE(Service_IR, "called, count={}", count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IR_USER::IR_USER() : ServiceFramework("ir:USER", 1) {
|
|
|
|
IR_USER::IR_USER() : ServiceFramework("ir:USER", 1) {
|
|
|
|