CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Stream Switching - (SOLVED)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

Stream Switching - (SOLVED)
PostPosted: Mon Mar 20, 2017 6:20 pm     Reply with quote

Hi All,

I have an application where i am using WiFi and a GPRS backup connection.
In a particularly remote scenario I'm faced with, there is no WiFi available so I figured i would just throw in a second GPRS modem each using a different service provider for redundancy. The internet must be available always.

I have developed a driver for a particular modem, of which i have over 20 deployed throughout my city since 2015... it works.

In this case both modems would be identical except for the SIM... i don't feel like loading 2 copies of the same driver is "efficient" if the only hardware difference is the TX/RX pins they are connected to.

Is there a way to simply tell the driver to use a different stream? or am I limited to using a Flag to control which fprintf statement to use on each of the different functions?... this would suck.

Or change which stream corresponds to what UART?
I would like to simply flip a bit and the same single driver now operates on a different UART.

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093


Last edited by Gabriel on Tue Mar 21, 2017 6:25 am; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 20, 2017 8:17 pm     Reply with quote

This topic was discussed in the following thread:

Use STREAM 'type' as function parameter.
http://www.ccsinfo.com/forum/viewtopic.php?t=55473
Quote:

or am I limited to using a Flag to control which fprintf statement to use on
each of the different functions?... this

You will need a flag, but not on every printf statement. Ttelmah provides
a more global solution.
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Tue Mar 21, 2017 6:24 am     Reply with quote

PCM, thank you!
Ttelmah...creative code as always!


G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group