changing skynet name
This commit is contained in:
parent
b848a05802
commit
7df9576de5
|
@ -22,7 +22,7 @@ $bot_dbaccess = DbAccess.new
|
|||
puts 'OK'
|
||||
|
||||
print 'synchronization '
|
||||
require_relative 'lib/skynet'
|
||||
require_relative 'lib/messaging'
|
||||
puts 'OK'
|
||||
|
||||
if $hardware_type != nil
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
|
||||
require_relative 'skynet/skynet'
|
||||
require_relative 'messaging/messaging'
|
||||
|
||||
# The unfortunate use of globals in this project: The SocketIO library we use to
|
||||
# talk to skynet stores blocks as lambdas and calls them later under a different
|
||||
|
@ -9,8 +9,8 @@ require_relative 'skynet/skynet'
|
|||
# device, but rather the current socket connection. Using a global is a quick
|
||||
# fix to ensure we always have easy access to the device. Pull requests welcome.
|
||||
|
||||
$skynet = Skynet.new
|
||||
$skynet.start
|
||||
$messaging = Messaging.new
|
||||
$messaging.start
|
||||
|
||||
#TODO: Daemonize this script:
|
||||
#https://www.ruby-toolbox.com/categories/daemonizing
|
|
@ -143,7 +143,7 @@ class MessageHandler
|
|||
|
||||
@dbaccess.write_to_log(2,"return_message = #{return_message}")
|
||||
|
||||
$skynet.send_message(sender, return_message)
|
||||
$messaging.send_message(sender, return_message)
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -187,7 +187,7 @@ class MessageHandler
|
|||
:logs => log_list
|
||||
}
|
||||
|
||||
$skynet.send_message(sender, return_message)
|
||||
$messaging.send_message(sender, return_message)
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -223,7 +223,7 @@ class MessageHandler
|
|||
@dbaccess.write_to_log(2,"reply = #{return_message}")
|
||||
|
||||
|
||||
$skynet.send_message(sender, return_message)
|
||||
$messaging.send_message(sender, return_message)
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -306,7 +306,7 @@ class MessageHandler
|
|||
|
||||
@dbaccess.write_to_log(2,'sending comfirmation')
|
||||
|
||||
$skynet.confirmed = false
|
||||
$messaging.confirmed = false
|
||||
|
||||
send_confirmation(sender, time_stamp)
|
||||
|
||||
|
@ -315,7 +315,7 @@ class MessageHandler
|
|||
@dbaccess.write_to_log(2,'no command in message')
|
||||
@dbaccess.write_to_log(2,'sending error')
|
||||
|
||||
$skynet.confirmed = false
|
||||
$messaging.confirmed = false
|
||||
send_error(sender, time_stamp, 'no command in message')
|
||||
|
||||
end
|
||||
|
@ -370,7 +370,7 @@ class MessageHandler
|
|||
|
||||
@dbaccess.write_to_log(2,'sending comfirmation')
|
||||
|
||||
$skynet.confirmed = false
|
||||
$messaging.confirmed = false
|
||||
|
||||
command =
|
||||
{
|
||||
|
@ -379,7 +379,7 @@ class MessageHandler
|
|||
:confirm_id => time_stamp
|
||||
}
|
||||
|
||||
$skynet.send_message(sender, command)
|
||||
$messaging.send_message(sender, command)
|
||||
|
||||
@dbaccess.write_to_log(2,'done')
|
||||
|
||||
|
@ -394,7 +394,7 @@ class MessageHandler
|
|||
:time_stamp => Time.now.to_f.to_s,
|
||||
:confirm_id => time_stamp
|
||||
}
|
||||
$skynet.send_message(destination, command)
|
||||
$messaging.send_message(destination, command)
|
||||
end
|
||||
|
||||
def send_error(destination, time_stamp, error)
|
||||
|
@ -410,7 +410,7 @@ class MessageHandler
|
|||
:confirm_id => time_stamp,
|
||||
:error => error
|
||||
}
|
||||
$skynet.send_message(destination, command)
|
||||
$messaging.send_message(destination, command)
|
||||
end
|
||||
|
||||
end
|
|
@ -10,7 +10,7 @@ require_relative 'messagehandler.rb'
|
|||
|
||||
# The Device class is temporarily inheriting from Tim's HardwareInterface.
|
||||
# Eventually, we should merge the two projects, but this is good enough for now.
|
||||
class Skynet
|
||||
class Messaging
|
||||
|
||||
include Credentials, WebSocket
|
||||
|
|
@ -13,12 +13,12 @@ module WebSocket
|
|||
#Handles self identification on skynet by responding to the :indentify with a
|
||||
#:identity event / credentials Hash.
|
||||
def create_identify_event
|
||||
$skynet.socket.on :identify do |data|
|
||||
$messaging.socket.on :identify do |data|
|
||||
self.emit :identity, {
|
||||
uuid: $skynet.uuid,
|
||||
token: $skynet.token,
|
||||
uuid: $messaging.uuid,
|
||||
token: $messaging.token,
|
||||
socketid: data['socketid']}
|
||||
$skynet.identified = true
|
||||
$messaging.identified = true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -28,8 +28,8 @@ module WebSocket
|
|||
# $skynet.handle_message(channel, message)
|
||||
#end
|
||||
|
||||
$skynet.socket.on :message do |message|
|
||||
$skynet.handle_message(message)
|
||||
$messaging.socket.on :message do |message|
|
||||
$messaging.handle_message(message)
|
||||
end
|
||||
end
|
||||
|
|
@ -26,16 +26,16 @@ write('MOVEMENT_INVERT_ENDPOINTS_Z' , 0)
|
|||
write('MOVEMENT_INVERT_MOTOR_X' , 0)
|
||||
write('MOVEMENT_INVERT_MOTOR_Y' , 0)
|
||||
write('MOVEMENT_INVERT_MOTOR_Z' , 0)
|
||||
write('MOVEMENT_STEPS_ACC_DEC_X' , 250)
|
||||
write('MOVEMENT_STEPS_ACC_DEC_Y' , 250)
|
||||
write('MOVEMENT_STEPS_ACC_DEC_X' , 2000)
|
||||
write('MOVEMENT_STEPS_ACC_DEC_Y' , 2000)
|
||||
write('MOVEMENT_STEPS_ACC_DEC_Z' , 250)
|
||||
write('MOVEMENT_HOME_UP_X' , 0)
|
||||
write('MOVEMENT_HOME_UP_Y' , 0)
|
||||
write('MOVEMENT_HOME_UP_Z' , 1)
|
||||
write('MOVEMENT_MIN_SPD_X' , 220)
|
||||
write('MOVEMENT_MIN_SPD_Y' , 220)
|
||||
write('MOVEMENT_MIN_SPD_X' , 200)
|
||||
write('MOVEMENT_MIN_SPD_Y' , 100)
|
||||
write('MOVEMENT_MIN_SPD_Z' , 220)
|
||||
write('MOVEMENT_MAX_SPD_X' , 2200)
|
||||
write('MOVEMENT_MAX_SPD_Y' , 2200)
|
||||
write('MOVEMENT_MAX_SPD_X' , 5000)
|
||||
write('MOVEMENT_MAX_SPD_Y' , 1010)
|
||||
write('MOVEMENT_MAX_SPD_Z' , 2200)
|
||||
|
||||
|
|
Loading…
Reference in a new issue