Skip to content

Commit 9aa0312

Browse files
author
Patrick Bechon
committed
Add a new message to request the resending of a message
1 parent a268f28 commit 9aa0312

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/KerbalSimpit.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ void KerbalSimpit::deregisterChannel(byte channelID)
8585
_send(DEREGISTER_MESSAGE, &channelID, 1);
8686
}
8787

88+
void KerbalSimpit::requestMessageOnChannel(byte channelID){
89+
_send(REQUEST_MESSAGE, &channelID, 1);
90+
}
91+
8892
void KerbalSimpit::printToKSP(String msg){
8993
printToKSP(msg, 0);
9094
}

src/KerbalSimpit.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ class KerbalSimpit
138138
void printToKSP(String msg);
139139
void printToKSP(String msg, byte options);
140140

141+
/**
142+
* Ask Simpit to resend a message on the given channel (useful for channels that only send on change).
143+
* When subscribing on a channel, a message is automatically sent so there is no need to call this during init.
144+
* May not work on all channels.
145+
* @param channelID The channel ID to request from (taken from the OutboundPackets enum). Use 0 as a special value for all channels
146+
*/
147+
void requestMessageOnChannel(byte channelID);
148+
141149
/**
142150
* Number of message dropped due to corrupted packet (missing data or bad checksum).
143151
* This may not be accurate in all cases, some packets can be lost without being noticed here in case of extreme congestion.

src/KerbalSimpitMessageTypes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ enum InboundPackets
238238
/** Deregister, indicate that no further messages
239239
for the given channel should be sent. */
240240
DEREGISTER_MESSAGE = 9,
241+
/** Request a new message to be sent on this channel (used for channel that only send message on request).
242+
* If requested on the channel 0, it will trigger a new message on all subscribed channels.
243+
* May not work on all channels. */
244+
REQUEST_MESSAGE = 29,
241245
// Custom action packets activate and deactivate custom action groups
242246
/** Activate the given Custom Action Group(s). */
243247
CAGACTIVATE_MESSAGE = 10,

0 commit comments

Comments
 (0)