Skip to content

Commit

Permalink
deactivate() now returns a boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
afska committed Jan 2, 2024
1 parent e140d49 commit 8b58af2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Name | Return type | Description
--- | --- | ---
`isActive()` | **bool** | Returns whether the library is active or not.
`activate()` | **bool** | Activates the library. When an adapter is connected, it changes the state to `AUTHENTICATED`. It can also be used to disconnect or reset the adapter.
`deactivate()` | - | Deactivates the library.
`deactivate()` | **bool** | Puts the adapter into a low consumption mode and then deactivates the library. It returns a boolean indicating whether the transition to low consumption mode was successful.
`serve([gameName], [userName], [gameId])` | **bool** | Starts broadcasting a server and changes the state to `SERVING`. You can, optionally, provide a `gameName` (max `14` characters), a `userName` (max `8` characters), and a `gameId` *(0 ~ 0x7FFF)* that games will be able to read.
`getServers(servers, [onWait])` | **bool** | Fills the `servers` array with all the currently broadcasting servers. This action takes 1 second to complete, but you can optionally provide an `onWait()` function which will be invoked each time VBlank starts.
`getServersAsyncStart()` | **bool** | Starts looking for broadcasting servers and changes the state to `SEARCHING`. After this, call `getServersAsyncEnd(...)` 1 second later.
Expand Down
6 changes: 4 additions & 2 deletions lib/LinkWireless.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,15 @@ class LinkWireless {
return success;
}

void deactivate() {
sendCommand(LINK_WIRELESS_COMMAND_BYE);
bool deactivate() {
bool success = sendCommand(LINK_WIRELESS_COMMAND_BYE).success;

lastError = NONE;
isEnabled = false;
resetState();
stop();

return success;
}

bool serve(std::string gameName = "",
Expand Down

0 comments on commit 8b58af2

Please sign in to comment.