Killerbee- LED glow issue - radio

I am working on the Killerbee rzusb stick, mostly used to sniff/Listen data packets in radio platform.
I would like to program this device according to my need. There are three LED's on the stick, can anyone suggest me the command to make them TURN ON & OFF ???
Thanks in advance :)

I'm not familiar with the Killerbee, but in TinyOS you generally connect the Leds interface to the LedsC component and call Leds.led0On(), Leds.led1Off(), Leds.led2Toggle() and so on.
There should be an easy-to-read example of how to do it in the /opt/tinyos-2.x/apps/Blink-directory.

Related

changing button functions of sq23 camera

I recently got small action camera called sq23. I used it few times outdoors, found that I never take picture instead of video. But from stand-by state to video-ready state is tough, so I want to change the function of buttons in this camera.
I know how to program, but I don't know to access the code that original functionality is implemented. Can you provide some procedure or tools for accessing the original code?

Take a picture in Flash Player directly from camera (not via video capturing)

I would like to let the user taking a picture via web app.
I know the class flash.media.Camera but It doesn't take a picture directly, but you can capture an image from that - this kind of solution is not suitable for my needs since the resolution is pretty low.
I know the class flash.media.CameraUI but it is only works for the Air Runtime.
I'll appreciate to hear about an alternative.
Thanks
this kind of solution is not suitable for my needs since the resolution is pretty low.
You should set the apropriate resolution then.
Camera has a method setMode for that:
public function setMode(width:int, height:int, fps:Number, favorArea:Boolean = true):void

Code for A Graphical User Interface window

How would someone go about coding a 'window'? I'm starting to make a GUI, and I want to learn how to code one. One that can be skinnable, and one that actually loops and creates itself at runtime. I understand that this might be a bit vague, so I'll add details.
One that actually 'creates' itself. Most GUI tutorials I've looked on depends on an 'image' that just gets added on the screen. I want to be able to use skins in my windows. One where my 'skin' is just a collection of 'borders'. Then when I insert window.create(50,50) where 50,50 is my height, width, It would just create that window, following the skin.
I understand that it probably follows just like when a language draws a rectangle, it just follows a different set of rules (maybe?). However, for all my Google-fu skills I cannot find a tutorial that teaches me this.
Please Help. I didn't include the language I used as you can see, because I believe I just need to know how to create one. Anyway though, I am using Actionscript 3. A tutorial would be just fine, or even A SINGLE CLASS THAT HAS THIS FUNCTIONALITY, I'll just study the code. Or if you know one, maybe a whole book about GUI and programming it :D
Pure As3.0 GUI coding is quite troublesome. I try to Googling, but not come out well. anyway for my case, i generate using a SWC, and Class Mapping and Customizing. but i'm not sure best way. in other way i use a bit101 library. this is gives me want Window, Charts, Componets easily of high abstraction. see the below image.
It can be pretty hard and complicated to do, or very easy, it just depends on how flexible your solution should be. You need firstly to design a structure of your program and approach to the problem.
I like to go from the image of how it should look like from API point of view. I think I would create a GUI element like this:
var wholeGui:MyGUI = new MyGUI();
var window:IGuiElement = new GuiWindow(dataObject, skinObject);
wholeGui.addElement(window);
So what would you need?
1) Object that would manage all GUI elements. Why? Simply because your GUI elements shouldn't be destroyed by themselves if user will click "X" on your little window. The wholeGui object would manage them and listen for any events including those that would destroy them. You may consider creating custom events for interaction between the wholeGui object and your window object if this interaction is going to be complicated.
2) Interface for your GUI objects. Some problem here is that AS3 actually doesn't have interface for Sprite, and you would like to interact with it like with extended Sprite. The workaround here is to have in this interface a declaration like this:
function asSprite():Sprite;
And your implementation in GuiWindow would look like this:
public function asSprite():Sprite {
return this;
}
And your GuiWindow class should extend Sprite of course. Then you would have access to it's Sprite properties and methods by writing for example: window.asSprite.startDrag();
This interface should give you abilities that you need to operate on your GUI element.
3) Class for your GUI element, in this example GuiWindow.
4) Class for your data that would be injected into your element. If you would load data dynamically, and from some location, you would need to deal with the situation when no data can be provided - but that logic would be inside your window.
5) Class for your skin - so you would be able to dynamically create a skin object and use it to create your window in a way you want.
That's just few thoughts to consider.
PS. It may be good idea to fill GuiWindow object with data AFTER creating it, and not in constructor, as you would be able to visualize loading process then.

Basic MVC pattern communication

I just started to study the Model View Controller pattern. I now understand the basic usage of MVC, but when i tried to implement MVC in a simple test, i ran into a problem. Ofcoarse I could easily adjust the code so it works, but I wish to learn how to correctly implement the MVC pattern.
The test:
I used actionscript 3 to make a simple program. It consist of a turret, and a mouseclick. The turret is in the middle of the screen. When I click anywhere the turret rotates towards the point where I clicked. Both the mouse and the turret have their own model,view and controller. When I click, the MouseModel changes correctly. But for the actual TurretView to respond, the TurretModel must change its rotation variable and send out an event.
The question is who responds to the MouseModel event?
/------->MouseControl------\
/ \
MouseView ?<---MouseModel
TurretView <------------------TurretModel
TurretControl
I figured its best not to have MouseModel directly influence TurretModel or TurretControl, because this would require them to be an eventListener. Making TurretView listen to the MouseModel, and then tell TurretControl to adjust TurretModel, after wich TurretView can update trough a TurretModel event looks like a lot of extra code for a simple task. Also I'd rather not have MouseControl affect TurretModel, this would break the flexibility of the mouse as input for future classes.
Ow, also in which class do I put the code for the angle calculation?
Thanks in advance
Remember that the goal with MVC is primarily the separation of Model and View, and the Controller can serve as the communicator between the two.
Unless you are planning on storing each action that occurs (clicking, rotating, etc.), there is no real need for an action (in this situation) to send data to the Model. Everything you'd like to do should be easily handled with the Controller. So the flow would be:
Mouse click
Event is fired to trigger a command (in the Controller), passing along the mouse location
The command calculates the turret's rotation
The command tells the View to rotate the turret
This is, of course, my suggestion based off of your example. In truth, depending on the project, the above flow could easily change (for instance, in this situation it seems good to do rotation calculation in the command, but in other situations that may not make as much sense). Look at MVC as a goal - you're trying to separate these elements as much as possible, but there is no 100% "works-every-time" way to do it.
Robotlegs, a popular MVC framework, has a great diagram on their site showing how they tackled MVC:
http://www.robotlegs.org/diagram/
I'm not advertising that you NEED to use Robotlegs (it's good, but there's plenty of other alternatives), but they definitely made a pretty diagram :)
You should have one model, which then has pieces in it that you are currently calling MouseModel and TurretModel. You can either keep those names and breakdowns, or do something else once you have a better "handle" on what needs to be done.
The View that is tracking the mouse clicks should dispatch an event that your Controller component catches to update the TurretModel (at this point, there's probably no need for a MouseModel). Your TurretView can then update itself based on the TurretModel, or the Controller can update the TurretView based on the new value. This will depend on how you have it wired.
Usin a Framework such as Robotlegs can help you figure out all the ins and outs of this process, and I've heard that this book http://shop.oreilly.com/product/0636920021216.do provides a great explanation of MVC, even if you don't choose to use Robotlegs after you read it.

Flash & external form fields

Does anybody know if this is possible?
I am trying to create a flash movie that will show / preview what I am typing into a field in a normal HTML form. The call to update the flash movie would most likely be attached to an onKeyUp event.
Any advice or tutorials would be great
cheers!
Decbrad
Assuming you're using actionscript 3....
Check this out
You can also check this link out (its for Flex 3 though... AS3 should be similar for flash I believe)... I've used ExternalInterface in my Flex projects before.
As far as I'm aware, Flashplayer only listens to key events when it has focus (which it wouldn't have if you're typing into an HTML form. I'm not aware of any way to inject events into Flash with javascript.
Is there a particular reason why you can't use a text area in the actual flash movie itself?
My advise would be to grab your favorite event utility for JavaScript and then pair it with ExternalInterface. That way, you can add a callback to the EI in Flash which would mean that you could do something like this:
ExternalInterface.addCallback( "keyboardClicked", dispatcherFunc );
function dispatcherFunc():void
{
dispatchEvent( new Event( "javaScriptKeyClick" ) );
}
document.getElementById( "mySwf" ).keyboadClicked();
Hey guys, thanks for pointing me in the right direction! I haven't touched flash since version 4 so to say that i'm rusty... is an understatement!
The reason I haven't built the text area in the actual flash movie is because the system is 95% complete now and there's a lot of smarts on the server side. The flash preview is more or less the icing, as they say! Bit surprised there's not more of a hook into Flash.
Thanks again!
Dec