Poking around skynet- minor issues

pull/52/head
rick carlino 2014-06-01 10:35:06 -07:00
parent 3ef7b8bc37
commit 8223a2f07b
2 changed files with 18 additions and 6 deletions

View File

@ -3,6 +3,10 @@
#TODO: Indicator that lets user see Skynet connection status.
# Run this in the command line for diagnostics.
# ======
# curl -X GET http://skynet.im/subscribe/713c69b1-e36a-11e3-93f8-f3e7e8d1cce9?token=0waw1l97lbwc23xrh0oem7d8rbai3sor --header "skynet_auth_uuid: 4bb4a961-e8e6-11e3-93f8-f3e7e8d1cce9" --header "skynet_auth_token: jce90gf7szxxyldihii1m3xv5d9jatt9"
angular.module('FarmBot').controller "OverviewController", [
'$scope'
'Restangular'
@ -16,10 +20,15 @@ angular.module('FarmBot').controller "OverviewController", [
$scope.myUuid = "4bb4a961-e8e6-11e3-93f8-f3e7e8d1cce9"
$scope.myToken = "jce90gf7szxxyldihii1m3xv5d9jatt9"
$scope.connectToSkyNet()
$scope.goHome = ->
uuid = $scope.device.uuid
message = {}
message = {msg: "SYSTEM DIAGNOSTIC"}
window.sn = $scope.skynet
debugger
$scope.skynet.send(message, uuid)
return true
$scope.connectToSkyNet = ->
creds =
uuid: $scope.myUuid

View File

@ -17,17 +17,20 @@ Skynet = () ->
@parse(message)
send: (message, uuid) ->
envelope =
devices: uuid
payload: message
callback = (data) -> parse(data)
@socket.emit "message", envelope, callback
@socket.emit "message", envelope, =>
@parse(data)
parse: (message) ->
debugger
# Incase anyone was wondering what a returned JSON response looks
example_message =
devices:"4bb4a961-e8e6-11e3-93f8-f3e7e8d1cce9"
payload: {"hello":"world"}
fromUuid: "4bb4a961-e8e6-11e3-93f8-f3e7e8d1cce9"
console.log 'The app just hit skynet.parse, but its not implemented :('
angular.module('FarmBot').service 'Skynet',[
Skynet