Jump to content




Wireless Peripheral: Advantages of a wired network wirelessly

api wireless

  • You cannot reply to this topic
No replies to this topic

#1 Olacken

  • New Members
  • 1 posts
  • LocationSomhere between my keyboard and my chair

Posted 01 June 2016 - 09:27 PM

These programs are an API for people like me who are annoyed of these noisy wired cable which are ruining designs.

This api simply allow a computer to acces a remote peripheral almost like the built'in peripheral.

Hope you will like it.

How to use:
Peripheral side:
  • ​Place your periperal


  • Connect it to a computer (Directly or via wired modem)


  • On top of this computer place a wireless modem


  • Download and launch the WirelessPeripheralModem program (pastebin get mSEjs3Xf wlm)
Computer side:
  • Place your computer


  • On top of it a wireless modem


  • Dowload the WirelessPeripheralComputer api (pastebin get MQMMjJHY wlc)


  • Load it and use it in your programs

Actual methods:
-- the side is the classical side for wired periperal or "mode/side" for wireless ones
-- in this case modem is just the label of the distant computer
-- other args are the same as there peripheral api counterpart

os.loadAPI("wlc")
wlc.getNames([modem])
--return the list of all peripherals connected to this computer

wlc.isPresent(side)
--return true if a peripheral id connectes on side

wlc.getType(side)
--return the type of peripheral connected on side. If no peripheral return nil

wlc.getMethods(side)
--return a list of the names of all methods of the peripheral connected on side. If no peripheral return nil

wlc.call(side,method,...)
--Call the method on the peripheral at side, arguments (...) and return type depend on the method being called. If no peripheral return nil.

wlc.find(type[,fnFilter( name,object)])
--Find an attached peripheral of the given type(formated like the side for wirelless peripheral) and if founds returns tables of functions( like peripheral.find() see the computercraft craft wiki for more informations)

wlc.wrap(side)
--Return a table of functions, allowing you to call peripherals methods sa if the were normal lua function. If no peripheral return nil.


Known differences( Kind of issues):
  • DiskDrive cannot be mounted( I don't think I will ever fix this)
  • Event thrown by peripheral are'nt transmitted ( Working on an event listener to do it)
  • Not Smp antigrief friendly ( If you have any suggestion to protect feel free to propose)
ToDo List:
  • Add an event listener
  • Change function to not use modem and side but just a side composed like "modem.side"
  • Change (or add) actual wirelessPeripheralComputer api to replace actual periperal API ( todo just before make it possible) (Possibly toggleable)
  • Change the actual use of rednet to a more safe solution (Something like a symetric encrypted TCP like connection maybe)
  • Add an other program to grant a computer to act as a peripheral
  • Automaticly detect the wireless modem
  • (Change variables' name)
Download:






Wireless Peripheral Modem

pastebin get mSEjs3Xf wlm


Wireless Peripheral Computer

pastebin get MQMMjJHY wlc


Changelog:
Version 1.1:
-No more need of using 2 parameters just do "modem/side"
-Automaticaly detect wireless modem
-Methode can now be used to acces wired peripheral
-The API can now override peripheral API (just uncomment the first line)

Version1.0:
-initial release


PS:I'm having trouble ta add image I suppose related with this being my first post so I will add them later and also no idea how to add spoil so sorry for the length

Edited by Olacken, 02 June 2016 - 02:33 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users