Peripherals

SimpleBLE.connectFunction
connect(peripheral)

Connect to a peripheral. Generally you should disconnect when you're done with it

source
connect(callback, peripheral)
connect(peripheral) do
	# Stuff
end

Convenience function for automatically disconnecting from a peripheral once you're done with it

source
SimpleBLE.peripheral_readFunction
peripheral_read(peripheral, 
	service::Union{AbstractString, SBLEUUID, SBLESERVICE},
	characteristic::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC},
)

Read data from a characteristic.

service and characteristic can be AbstractStrings, SBLEUUIDs, or SBLESERVICE and SBLECHARACTERISTIC acquired by services.

source
SimpleBLE.write_requestFunction
write_request(peripheral,
	service::Union{AbstractString, SBLEUUID, SBLESERVICE},
	characteristic::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC},
	data <: Union{AbstractString, AbstractArray}
)

Write a request to a characteristic.

See also write_command

source
SimpleBLE.write_commandFunction
write_command(
	peripheral,
	service::Union{AbstractString, SBLEUUID, SBLESERVICE},
	characteristic::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC},
	data <: Union{AbstractString, AbstractArray}
)

Write a command to a characteristic.

See also write_request

source
Base.notifyFunction
notify(callback,
	peripheral::Peripheral,
	service::Union{AbstractString, SBLEUUID, SBLESERVICE},
	characteristic::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC}
)
notify(
	peripheral::Peripheral,
	service::Union{AbstractString, SBLEUUID, SBLESERVICE},
	characteristic::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC}
) do data
	# Stuff
end

Set a callback that is called when data is received from a Characteristic. notify is generally faster than indicate because it does not need to acknowledge that it received the data.

See also indicate

Warning

WARNING: YOU MUST NOT PASS THE data VECTOR OUTSIDE THE CALLBACK, IT IS NOT VALID AFTER THE CALLBACK FINISHES, IF YOU NEED TO KEEP THE DATA AFTER THE CALLBACK IS FINISHED, COPY IT!

source
SimpleBLE.indicateFunction
indicate(callback,
	peripheral::Peripheral,
	service::Union{AbstractString, SBLEUUID, SBLESERVICE},
	characteristic::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC}
)
indicate(
	peripheral::Peripheral,
	service::Union{AbstractString, SBLEUUID, SBLESERVICE},
	characteristic::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC}
) do data
	# Stuff
end

Set a callback that is called when data is received from a Characteristic. notify is generally faster than indicate because it does not need to acknowledge that it received the data.

See also notify

Warning

WARNING: YOU MUST NOT PASS THE data VECTOR OUTSIDE THE CALLBACK, IT IS NOT VALID AFTER THE CALLBACK FINISHES, IF YOU NEED TO KEEP THE DATA AFTER THE CALLBACK IS FINISHED, COPY IT!

source
SimpleBLE.unsubscribeFunction
unsubscribe(
	peripheral,
	service::Union{AbstractString, SBLEUUID, SBLESERVICE},
	characteristic::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC}
)

unsubscribe from a notify or indicate call.

source
SimpleBLE.read_descriptorFunction
read_descriptor(
	peripheral,
	service::Union{AbstractString, SBLEUUID, SBLESERVICE},
	characteristic::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC},
	descriptor::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC}
)

Read data from a descriptor.

source
SimpleBLE.write_descriptorFunction
write_descriptor(
	peripheral,
	service::Union{AbstractString, SBLEUUID, SBLESERVICE},
	characteristic::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC},
	descriptor::Union{AbstractString, SBLEUUID, SBLECHARACTERISTIC},
	data <: Union{AbstractString, AbstractArray}
)

Write data to a descriptor.

source