Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mrogaski committed Dec 18, 2015
2 parents b1495e6 + 17e0110 commit 5e42a6e
Show file tree
Hide file tree
Showing 7 changed files with 665 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Source files
# ============
*.lua text

# Luadoc output
# =============
*.html text
*.css text
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Change Log

This project uses [Semantic Versioning](http://semver.org/).

## Unreleased
### Fixed
- Now blocking our own requests and responses.

## 0.1.0-dev -- 2015-12-17
Initial commit.

[0.1.0]: https://github.com/AIE-Guild/GWSonar/compare/v0.1.0-dev...v0.1.0
16 changes: 15 additions & 1 deletion GWSonar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,26 @@ end
-- @param echo True is the plater receiving the message is the sender
-- @param message The message data
local function PingHandler(addon, sender, echo, message)
if addon == 'GWSonar' then

if addon == 'GWSonar' and not echo then

local op, guid, serial = strsplit('/', message)
if op == 'REQUEST' then

-- Send the response
local token = string.format('RESPONSE/%s/%s', guid, serial)
GreenWallAPI.SendMessage('GWSonar', token)

elseif op == 'RESPONSE' then

local delta = GetTime() - GWSonar.timestamp
table.insert(GWSonar.sample, delta)
Write('ping response received from %s, %.3f second(s).', sender, delta)

end

end

end


Expand All @@ -135,15 +143,21 @@ function GWSonar_OnLoad(self)
-- Register slash command handler
SLASH_GWSONAR1 = '/gwsonar'
function SlashCmdList.GWSONAR(msg, editbox)

if msg == 'ping' then

local token = Ping()
Write('ping request sent.')

elseif msg == 'stats' then

local n = #GWSonar.sample
local min, max = MinMax(GWSonar.sample)
local avg = Mean(GWSonar.sample)
Write('%d response(s); min/avg/max = %.3f/%.3f/%.3f', n, min, avg, max)

end

end

-- Register for events
Expand Down
6 changes: 3 additions & 3 deletions GWSonar.toc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Interface: 60200
## Title: GWSonar
## Notes: A demonstration of the WoW GreenWallAPI.
## Notes: A demonstration of the GreenWall add-on communication API.
## Author: Mark Rogaski <[email protected]>
## Version: 0.1.0-dev
## Version: 0.1.0-alpha
## URL: https://github.com/AIE-Guild/GWSonar
## DefaultState: enabled
## X-Category: Guild
## X-Date: 2015-12-17
## X-Date: 2015-12-18

GWSonar.lua
GWSonar.xml
257 changes: 257 additions & 0 deletions doc/files/GWSonar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Reference</title>
<link rel="stylesheet" href="../luadoc.css" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>

<body>
<div id="container">

<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->

<div id="main">

<div id="navigation">


<h1>LuaDoc</h1>
<ul>

<li><a href="../index.html">Index</a></li>

</ul>


<!-- Module list -->



<!-- File list -->

<h1>Files</h1>
<ul>

<li><strong>GWSonar.lua</strong></li>

</ul>






</div> <!-- id="navigation" -->

<div id="content">

<h1>File <code>GWSonar.lua</code></h1>







<h2>Functions</h2>
<table class="function_list">

<tr>
<td class="name" nowrap><a href="#Mean">Mean</a>&nbsp;(t)</td>
<td class="summary">Mean value from a table.</td>
</tr>

<tr>
<td class="name" nowrap><a href="#MinMax">MinMax</a>&nbsp;(t)</td>
<td class="summary">Minimum/maximum values from a table.</td>
</tr>

<tr>
<td class="name" nowrap><a href="#Ping">Ping</a>&nbsp;()</td>
<td class="summary">Send a ping request.</td>
</tr>

<tr>
<td class="name" nowrap><a href="#PingHandler">PingHandler</a>&nbsp;(addon, sender, echo, message)</td>
<td class="summary">Generate and process ping responses.</td>
</tr>

<tr>
<td class="name" nowrap><a href="#Write">Write</a>&nbsp;(...)</td>
<td class="summary">Write a message to the default chat frame.</td>
</tr>

</table>






<br/>
<br/>




<h2><a name="functions"></a>Functions</h2>
<dl class="function">



<dt><a name="Mean"></a><strong>Mean</strong>&nbsp;(t)</dt>
<dd>
Mean value from a table.


<h3>Parameters:</h3>
<ul>

<li>
<code><em>t</em></code>: A table of numeric values. Taken from http://lua-users.org/wiki/SimpleStats .
</li>

</ul>








</dd>




<dt><a name="MinMax"></a><strong>MinMax</strong>&nbsp;(t)</dt>
<dd>
Minimum/maximum values from a table.


<h3>Parameters:</h3>
<ul>

<li>
<code><em>t</em></code>: A table of numeric values. Taken from http://lua-users.org/wiki/SimpleStats .
</li>

</ul>








</dd>




<dt><a name="Ping"></a><strong>Ping</strong>&nbsp;()</dt>
<dd>
Send a ping request.









</dd>




<dt><a name="PingHandler"></a><strong>PingHandler</strong>&nbsp;(addon, sender, echo, message)</dt>
<dd>
Generate and process ping responses.


<h3>Parameters:</h3>
<ul>

<li>
<code><em>addon</em></code>: The sending addon
</li>

<li>
<code><em>sender</em></code>: The sending player
</li>

<li>
<code><em>echo</em></code>: True is the plater receiving the message is the sender
</li>

<li>
<code><em>message</em></code>: The message data
</li>

</ul>








</dd>




<dt><a name="Write"></a><strong>Write</strong>&nbsp;(...)</dt>
<dd>
Write a message to the default chat frame.


<h3>Parameters:</h3>
<ul>

<li>
<code><em>...</em></code>: A list of the string and arguments for substitution using the syntax of string.format.
</li>

</ul>








</dd>


</dl>







</div> <!-- id="content" -->

</div> <!-- id="main" -->

<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->

</div> <!-- id="container" -->
</body>
</html>
Loading

0 comments on commit 5e42a6e

Please sign in to comment.