Win API for Uniden BCD396T

Status
Not open for further replies.

jd970

Member
Joined
Aug 29, 2006
Messages
35
Location
CO
I’m exploring options for writing an application that interfaces with the scanner. Uniden has a protocol document where I can send/receive commands over the com port.

I was hoping that somebody might know of an API (Preferably .net) that I might be able to get my greedy hands on.

Thx.
 

swest90

Member
Joined
Aug 8, 2004
Messages
171
Unfortunately no one has produced one. Several of us have written our own small apps but I havent seen anyone release any code or produce a good set of objects to use. So its up to you. The command set is basic and a breeze to use, im sure you wont have a problem with it.

Good luck
Shawn
 

lostdog19

Member
Joined
Aug 25, 2006
Messages
21
No API... yet

I asked for the same thing for the BR330T a week ago, but there didn't appear to be one. I'm in the process of creating one in C# using .NET Framework 2.0. It also appears that the Command Codes are VERY similar for the BR330T and the BCD396T. What are you hoping to program?
 

jd970

Member
Joined
Aug 29, 2006
Messages
35
Location
CO
Shawn,

How far did you get on your app and what language is it in?


swest90 said:
Unfortunately no one has produced one. Several of us have written our own small apps but I havent seen anyone release any code or produce a good set of objects to use. So its up to you. The command set is basic and a breeze to use, im sure you wont have a problem with it.

Good luck
Shawn
 

jd970

Member
Joined
Aug 29, 2006
Messages
35
Location
CO
Lostdog.

I'm hoping to program some software that helps me monitor unknown talk groups for the Colorado DTRS system. I’d like to automate the recording and programming of the scanner. I'm almost done writing a page scraper for the RR Colorado DTRS project that grabs all the unknown talk groups.

I’m really proficient in C# as programming .net is my day job and my hobby. I use good standards and such. I have a little C# code on my site. (I’m not the greatest at writing good consistent articles). Do you need help with the coding?

I guess I'm really trying to fill some free time w/ something else besides work. I basically just got back in to scanning after a 9 year hiatus. (A lot has changed)

PS:

My article page:
http://www.jaydouglas.com/Articles/



lostdog19 said:
I asked for the same thing for the BR330T a week ago, but there didn't appear to be one. I'm in the process of creating one in C# using .NET Framework 2.0. It also appears that the Command Codes are VERY similar for the BR330T and the BCD396T. What are you hoping to program?
 

lostdog19

Member
Joined
Aug 25, 2006
Messages
21
jd970 said:
Lostdog.

I'm hoping to program some software that helps me monitor unknown talk groups for the Colorado DTRS system. I’d like to automate the recording and programming of the scanner. I'm almost done writing a page scraper for the RR Colorado DTRS project that grabs all the unknown talk groups.

I’m really proficient in C# as programming .net is my day job and my hobby. I use good standards and such. I have a little C# code on my site. (I’m not the greatest at writing good consistent articles). Do you need help with the coding?

I guess I'm really trying to fill some free time w/ something else besides work. I basically just got back in to scanning after a 9 year hiatus. (A lot has changed)

PS:

My article page:
http://www.jaydouglas.com/Articles/

For me, I've only used C# a little in my worklife, but only for in-house testing code, as I am a Software QA Engineer. I've used it a bit on personal projects here or there, but nothing spectacular. I decided to throw together an API for a couple reasons. First, I haven't used C# in a while, so I wanted to refresh my skills. Second, I've been away from scanners for almost 15 years and figure this is the best way for me to figure out all the new scanning technology built into my new scanner (which I just got last week).

Currently I've got functions to cover all the commands in the Remote Command List grid (of the PDF file) except for the "Scan Settings" category. I have taken a little break in building up the APIs and have been toying with a UI, to make sure that the API is user friendly. So at this point it covers remote control of the scanner and all settings that don't manipulate Systems.
 

jd970

Member
Joined
Aug 29, 2006
Messages
35
Location
CO
Would you be willing to share the source code?

lostdog19 said:
Currently I've got functions to cover all the commands in the Remote Command List grid (of the PDF file) except for the "Scan Settings" category. I have taken a little break in building up the APIs and have been toying with a UI, to make sure that the API is user friendly. So at this point it covers remote control of the scanner and all settings that don't manipulate Systems.
 

oritpro

Member
Joined
Apr 6, 2006
Messages
72
Location
Portland, OR
jd970 said:
I’m exploring options for writing an application that interfaces with the scanner. Uniden has a protocol document where I can send/receive commands over the com port.

I was hoping that somebody might know of an API (Preferably .net) that I might be able to get my greedy hands on.

Thx.

I haven't seen an API although I'll bet Butel Software built one for their products. The command set is really easy, I tinkered with it over a weekend using Hyperterminal and have been just itching to write my own software.

Unfortunately, I am working on a college degree and won't have time until graduation next summer.

For someone that is already setup for coding, It would be a breeeze to build an API for the 396.
 

jd970

Member
Joined
Aug 29, 2006
Messages
35
Location
CO
lostdog19 said:
I'd need to clean things up a bit. Otherwise I'd be embarressed by the state of it now. ;)

Have you written any connection management code allowing pooling and queing of Tx/Rx?

It looks like the command set on the pdf is really straight forward. Might take a little thinking to create a clean object model.

I'll start working on it over this weekend. I'll keep everybody posted on my progress.
 

lostdog19

Member
Joined
Aug 25, 2006
Messages
21
jd970 said:
Have you written any connection management code allowing pooling and queing of Tx/Rx?

It looks like the command set on the pdf is really straight forward. Might take a little thinking to create a clean object model.

I'll start working on it over this weekend. I'll keep everybody posted on my progress.

I've got no queueing. I just have a SendToScanner method that takes an input string and then does a readline to get the response, splits out the response to a string array, and returns the array. Individual methods create the input string based on parameters and assign member variables accordingly based on the response array.

But that does raise another question. Will the scanner ever send a response to something without me sending a command? If so, I guess that'd need to be handled by a send and recieve queue.
 

jd970

Member
Joined
Aug 29, 2006
Messages
35
Location
CO
oritpro said:
I haven't seen an API although I'll bet Butel Software built one for their products..

I've downloaded the trial and was unable to easily find a .dll I could import or anything of the sort. I searched through the site via google and browsing and was unable to locate any api documentation.

I'm going to try to make time to get an object model going. This means I need to frist write all the connection code/driver for RS-232 which I think is all COM/OCX WinAPI stuff. (Not even going to think about the USB driver right now). I think Lostdog might have wrote some connection code, and if I can get my hands on it, I'm sure I can bang through the architecture pretty quick.
 

jd970

Member
Joined
Aug 29, 2006
Messages
35
Location
CO
lostdog19 said:
I've got no queueing. I just have a SendToScanner method that takes an input string and then does a readline to get the response, splits out the response to a string array, and returns the array. Individual methods create the input string based on parameters and assign member variables accordingly based on the response array.

But that does raise another question. Will the scanner ever send a response to something without me sending a command? If so, I guess that'd need to be handled by a send and recieve queue.



Queuing would be very beneficial for work flow reasons. I’m pretty certain that the scanner doesn’t allow for multiple exchanges but the client app should. So, if I’m working on sending a set of 10 different separate commands from 3 different work flows (i.e. system update / monitoring / locking channels) the app can facilitate all the communication. It’s like a real simple BizTalk process.

(Too nerdy)?

2 Questions:

What namepace or WinAPI did you use to send/rec your commands?

Can I extend your source code by adding queuing / work-flow mechanisms? Don’t worry about the state of your code, I can help clean up and extend.
 

lostdog19

Member
Joined
Aug 25, 2006
Messages
21
jd970 said:
I've downloaded the trial and was unable to easily find a .dll I could import or anything of the sort. I searched through the site via google and browsing and was unable to locate any api documentation.

I'm going to try to make time to get an object model going. This means I need to frist write all the connection code/driver for RS-232 which I think is all COM/OCX WinAPI stuff. (Not even going to think about the USB driver right now). I think Lostdog might have wrote some connection code, and if I can get my hands on it, I'm sure I can bang through the architecture pretty quick.

Oh, it's much simpler than COM/OCX stuff (provided you use .NET Framework 2.0). I don't have the code in front of me, but it goes something like this.

class Scanner
{
private SerialPort sp;
private string response;

Scanner()
{
sp = new SerialPort("COM1", 115200);
sp.Open();
}

private void SendToScanner(string RemoteCommand)
{
sp.WriteLine(RemoteCommand);
response = sp.ReadLine();
}

}


At that point, your associated methods just call into SendToScanner and read the response.
 

lostdog19

Member
Joined
Aug 25, 2006
Messages
21
jd970 said:
Queuing would be very beneficial for work flow reasons. I’m pretty certain that the scanner doesn’t allow for multiple exchanges but the client app should. So, if I’m working on sending a set of 10 different separate commands from 3 different work flows (i.e. system update / monitoring / locking channels) the app can facilitate all the communication. It’s like a real simple BizTalk process.

(Too nerdy)?

2 Questions:

What namepace or WinAPI did you use to send/rec your commands?

Can I extend your source code by adding queuing / work-flow mechanisms? Don’t worry about the state of your code, I can help clean up and extend.

Right now, I'm trying to pin down a design, so it seems that every night, I'm changing the flow of things. Once I get something that I'm happy with for longer than a day, I'll let you take a look.
 

lostdog19

Member
Joined
Aug 25, 2006
Messages
21
jd970 said:
Queuing would be very beneficial for work flow reasons. I’m pretty certain that the scanner doesn’t allow for multiple exchanges but the client app should. So, if I’m working on sending a set of 10 different separate commands from 3 different work flows (i.e. system update / monitoring / locking channels) the app can facilitate all the communication. It’s like a real simple BizTalk process.

(Too nerdy)?

2 Questions:

What namepace or WinAPI did you use to send/rec your commands?

Can I extend your source code by adding queuing / work-flow mechanisms? Don’t worry about the state of your code, I can help clean up and extend.

Well, I've changed the design to incorporate queues now for the remote commands as well as the results. Good thing I did, because apparently its possible for the scanner to send responses without the computer requesting anything. When I change the volume or squelch on the scanner, I get a response.
 

wm8s

Member
Premium Subscriber
Joined
Oct 30, 2004
Messages
787
Location
Houston, TX
I developed an object for my BCD996T's control program (a touchscreen interface that also controls my Kenwood TS2000 and TMD700). I don't think that radio has any asynchronous, i.e., non-predictive, I/O. To wit, everything it tells you is in response to a set or query command. I understand that the 996 is similar to the 396 [I'll check on the VOL and SQL commands to see if they're asynch].

I derived all three objects from a more generic class (a series of derived classes, actually) written to handle asynchronous radios, like the TS2000 or TMD700A. And while it certainly works fine for keeping up with the radio's reception status, etc. (e.g., the GID, GLG, and STS commands, where you don't care about tying a particular query to a particular response, and even other query versions of a lot of the other commands), the asynch model does not work well for many [most?] commands (especially "set" commands, like deleting a system or adding a new group, where you _do_ need to associate a particular response with a particular command), and it does not at all for a few commands (like the commands that enumerate the locked out frequencies, etc.)

My object model is:
Radio ->
....SerialRadio ->
........AsynchSerialRadio ->
............TMD700A
............TS2000
............BCD996T

The AsynchSerialRadio objects use two background threads, a writer thread, which pulls strings from a managed Queue object (which is itself synchronized with lock{}s and an event object to signal addition of elements) and writes them to the serialport, and a reader queue, which pulls strings from the serialport and parses them and invokes the appropriate method for the received command. The UI then uses a third thread (the main thread, actually) to manage interaction between the user and the radio objects. Every time the reader thread changes the radio's object, it fires off a notification event that the UI thread hooks into to receive notifications of changes in properties of the radio's object, to, e.g., update the screen, etc.

I started work on a SynchSerialRadio class derived from the SerialRadio class that would follow a synchronous model, and I might eventually switch to that model for the BCD996A class, since the radio is, as far as I can tell, purely synchronous. This model would necessitate deciding, for example, how to handle read timeouts, how to keep reads and writes synchronized, etc., but would obviate the problems with trying to follow an asynch model for a radio that isn't at all asynchronous.

...R
 
Last edited:

lostdog19

Member
Joined
Aug 25, 2006
Messages
21
wm8s said:
I developed an object for my BCD996T's control program (a touchscreen interface that also controls my Kenwood TS2000 and TMD700). I don't think that radio has any asynchronous, i.e., non-predictive, I/O. To wit, everything it tells you is in response to a set or query command. I understand that the 996 is similar to the 396 [I'll check on the VOL and SQL commands to see if they're asynch].

I derived all three objects from a more generic class (a series of derived classes, actually) written to handle asynchronous radios, like the TS2000 or TMD700A. And while it certainly works fine for keeping up with the radio's reception status, etc. (e.g., the GID, GLG, and STS commands, where you don't care about tying a particular query to a particular response, and even other query versions of a lot of the other commands), the asynch model does not work well for many [most?] commands (especially "set" commands, like deleting a system or adding a new group, where you _do_ need to associate a particular response with a particular command), and it does not at all for a few commands (like the commands that enumerate the locked out frequencies, etc.)

My object model is:
Radio ->
....SerialRadio ->
........AsynchSerialRadio ->
............TMD700A
............TS2000
............BCD996T

The AsynchSerialRadio objects use two background threads, a writer thread, which pulls strings from a managed Queue object (which is itself synchronized with lock{}s and an event object to signal addition of elements) and writes them to the serialport, and a reader queue, which pulls strings from the serialport and parses them and invokes the appropriate method for the received command. The UI then uses a third thread (the main thread, actually) to manage interaction between the user and the radio objects. Every time the reader thread changes the radio's object, it fires off a notification event that the UI thread hooks into to receive notifications of changes in properties of the radio's object, to, e.g., update the screen, etc.

I started work on a SynchSerialRadio class derived from the SerialRadio class that would follow a synchronous model, and I might eventually switch to that model for the BCD996A class, since the radio is, as far as I can tell, purely synchronous. This model would necessitate deciding, for example, how to handle read timeouts, how to keep reads and writes synchronized, etc., but would obviate the problems with trying to follow an asynch model for a radio that isn't at all asynchronous.

...R

I've also got multiple threads as well to handle queues. My SerialPort object has an eventhandler for reading data when it hits, and whenever I change the volume or squelch, I get a response. This is without sending a Get Volume or Squelch remote command. I have a BR330T, so I am not sure if it works any different than yours, as I can only speak about what I've seen.
 

lostdog19

Member
Joined
Aug 25, 2006
Messages
21
lostdog19 said:
I've also got multiple threads as well to handle queues. My SerialPort object has an eventhandler for reading data when it hits, and whenever I change the volume or squelch, I get a response. This is without sending a Get Volume or Squelch remote command. I have a BR330T, so I am not sure if it works any different than yours, as I can only speak about what I've seen.

Foot in mouth time... I had forgotten about another thread that polled the volume every 3 seconds, so thus accounting for the constant update which I mistook for async responses.
 
Status
Not open for further replies.
Top