Split device registration and socket connection

Added some new functions to
register device
start session
stop session