Sites
TODO: Description of Site.
Creating a Site is as easy as choosing a name, using the User.create_site()
method
my_site = u.create_site("My Awesome Site")
Then to retrieve your created sites, you can User.get_sites()
to see all sites
my_sites = u.get_sites()
for site in my_sites:
print(site.name, site.subject_id)
Then a specific site can be access by it’s ID with User.get_site()
my_site = u.get_site('xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
Renaming a Site can be done with Site.rename()
my_site.rename("My Super Awesome Site!")
Adding SymBLE Endnodes to the Site can be done with the Site.add_node()
method; While adding SymBLE AccessPoints can be done with the
Site.add_access_point()
method.
my_lb = u.get_node('XX:XX:XX:XX:XX:XX')
my_tag = u.get_node('YY:YY:YY:YY:YY:YY')
my_ap = u.get_access_point('C0:00:00:00:ZZ:ZZ')
my_site.add_node(my_lb)
my_site.add_node(my_tag)
my_site.add_access_point(my_ap)
Then, to see what is registered to your site, the Site.get_nodes()
method
will return all SymBLE Endnodes, while Site.get_access_points will return all
registered AccessPoint
objects.
print("My Endnodes:")
my_nodes = my_site.get_nodes()
for node in my_nodes:
print('\t', node.name, node.mac_address)
print("\n=========================\n")
print("My AccessPoints:")
my_aps = my_site.get_access_points()
for ap in my_aps:
print('\t', ap.name, ap.mac_address)
SymBLE Endnodes can be removed with the Site.remove_node()
method, while
SymBLE AccessPoints can be removed with the Site.remove_access_point()
method
my_site.remove_endnode(my_lb)
my_site.remove_access_point(my_ap)
To see who has access to your Sites, there are SiteUser
objects. This
can be viewed with
site_users = my_site.get_site_users()
for user in site_users:
print(user.name, user.subject_id)
A Site User can also be added or removed to a Site, when the proper permissions
are set; Using the Site.add_site_user()
and Site.remove_site_user
respectively
user = my_site.get_site_user('xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
my_site.add_site_user(user)
my_site.remove_site_user(user)
Area
Areas are contained within a Site to identify a specific Area
of the
Site
. They are created with the Site.create_area()
method
my_area = my_site.create_area("Entry Point")
To see what Site owns an Area, the parent_site property can be used
my_site = my_area.parent_site
Then, removing a Area
is done with the User.delete_area()
my_site.delete_area(my_area)
SymBLE Endnodes and AccessPoints can be added/removed/retrieved to/from Areas in exact the same way that they can be added in Sites.
Zone
Zones are then contained within Areas to identify a specific Zone
of an
Area
. They are created with the Area.create_zone()
method
my_area.create_zone("Left Side")
Like the Area
object, there is a parent_site property, but there is also
an additional parent_area site to connect the two objects together.
my_site = my_zone.parent_site
my_area = my_zone.parent_area
Then, removing a Zone
from the Area
can be done with the
Area.delete_zone()
method.
my_area.delete_zone(my_zone)
SymBLE Endnodes and AccessPoints can be added/removed/retrieved to/from Areas in exact the same way that they can be added in Sites and Zones.