PEU
Flashlight Enthusiast
I'm trying to buid a flashlight, so in the process I thought of an API for the unit, since I believe that an open standard is better than a closed one, I put this work for consideration and ampliation, with the hope that someone likes the idea and helps me to make it better.
And since is open source, may be more manufacturers use it for the benefit of all.
Thanks
Pablo
# FLAPI a Flashlight API
#
# Original idea by Pablo Untroib
# Left on the Open Source the second after thinking of it
#
# Copyright (c) 2004 This API belongs to the common
# knowledge of the CPF forum
#
# This file is part of FLAPI
#
# FLAPI is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# FLAPI is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details: www.gnu.org
#
# Why an API you ask: because there are on the market microprocessed flashlights that with little
# or no modification can be user customized to do specific tasks.
#
# If you are a manufacturer and want to use this API you are free to do so, you must disclose
# which functions are implemented, but you're not obligated (but welcomed) to disclose the
# source code of your implementation
#
# This is the first attempt in my life to write an Application Programming Interface, I readed on the
# web about APIs before attempting doing this, but I saw no clear guidelines on how to do it, so
# I'll do it my basic way, in hopes that someone with more knowledge, straights it later.
#
# I will call this version 0.1 towards the final and polished 1.0
Part 1 - Flashlight hardware capabilities
Button (x)
X= defines how many on/off buttons the unit have
Selector (x)
X= defines how many selectors the unit have
ButtonSpec (x,y)
X= defines the characteristics of the button
Y= defines which button has the described characteristics
Examples:
X=1 on/off button
X=2 on/off button with momentary on/off
SelectorSpec (x,y,z)
X=2 2 positions selector
X=n n position selector
Y=0 the selector does not have pushbutton capability
Y=1 the selector have pushbutton capability
Z= defines which selector has the described characteristics
Sensor(x)
X=1 temperature
X=2 over voltage
X=3 low battery
Lights(x)
X= defines the quantity of lights available
LightSpec (x,y)
X=1 LED
X=2 Incandecent
X=3 HID
X=n to be defined
Y= defines which light has the described characteristics
Powerlevel(x)
X=0 Low level
X=1 Max level
X=n intermediate levels
Memory(x)
X= bytes available for programming storage
Part 2 - Flashlight functions definition
Pulse(x,y)
X= on time
Y= off time
Example
Pulse (5,3) If you want to send a 5 second signal followed by a 3 second pause
Strobo (x,y,z)
X=frequency
Y=on pulse width, must be checked for consistency against the frequency
Z= off pulse width, must be checked for consistency against the frequency
Signal (Pulse(x,y)….Pulse(xn,yn))
The signal will be componed out of pulses, for example a SOS signal is composed by joining 9 pulses.
Part 3 - Statements
To be continued
And since is open source, may be more manufacturers use it for the benefit of all.
Thanks
Pablo
# FLAPI a Flashlight API
#
# Original idea by Pablo Untroib
# Left on the Open Source the second after thinking of it
#
# Copyright (c) 2004 This API belongs to the common
# knowledge of the CPF forum
#
# This file is part of FLAPI
#
# FLAPI is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# FLAPI is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details: www.gnu.org
#
# Why an API you ask: because there are on the market microprocessed flashlights that with little
# or no modification can be user customized to do specific tasks.
#
# If you are a manufacturer and want to use this API you are free to do so, you must disclose
# which functions are implemented, but you're not obligated (but welcomed) to disclose the
# source code of your implementation
#
# This is the first attempt in my life to write an Application Programming Interface, I readed on the
# web about APIs before attempting doing this, but I saw no clear guidelines on how to do it, so
# I'll do it my basic way, in hopes that someone with more knowledge, straights it later.
#
# I will call this version 0.1 towards the final and polished 1.0
Part 1 - Flashlight hardware capabilities
Button (x)
X= defines how many on/off buttons the unit have
Selector (x)
X= defines how many selectors the unit have
ButtonSpec (x,y)
X= defines the characteristics of the button
Y= defines which button has the described characteristics
Examples:
X=1 on/off button
X=2 on/off button with momentary on/off
SelectorSpec (x,y,z)
X=2 2 positions selector
X=n n position selector
Y=0 the selector does not have pushbutton capability
Y=1 the selector have pushbutton capability
Z= defines which selector has the described characteristics
Sensor(x)
X=1 temperature
X=2 over voltage
X=3 low battery
Lights(x)
X= defines the quantity of lights available
LightSpec (x,y)
X=1 LED
X=2 Incandecent
X=3 HID
X=n to be defined
Y= defines which light has the described characteristics
Powerlevel(x)
X=0 Low level
X=1 Max level
X=n intermediate levels
Memory(x)
X= bytes available for programming storage
Part 2 - Flashlight functions definition
Pulse(x,y)
X= on time
Y= off time
Example
Pulse (5,3) If you want to send a 5 second signal followed by a 3 second pause
Strobo (x,y,z)
X=frequency
Y=on pulse width, must be checked for consistency against the frequency
Z= off pulse width, must be checked for consistency against the frequency
Signal (Pulse(x,y)….Pulse(xn,yn))
The signal will be componed out of pulses, for example a SOS signal is composed by joining 9 pulses.
Part 3 - Statements
To be continued